Skip to content

Commit ea7bff8

Browse files
chore: add medical technology concepts
1 parent c61a9e5 commit ea7bff8

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright (c) 2023. Smart Operating Block
3+
*
4+
* Use of this source code is governed by an MIT-style
5+
* license that can be found in the LICENSE file or at
6+
* https://opensource.org/licenses/MIT.
7+
*/
8+
9+
package entity.medicaltechnology
10+
11+
import entity.zone.RoomID
12+
13+
/**
14+
* Describe a medical technology used inside the operating block.
15+
* This is an entity that is identified by an [id].
16+
* In addition, it has a [name], a [description] and a [type].
17+
* A medical technology can be associated to a [entity.zone.Room] through its [roomId].
18+
*/
19+
data class MedicalTechnology(
20+
val id: MedicalTechnologyID,
21+
val name: String,
22+
val description: String,
23+
val type: MedicalTechnologyType,
24+
val roomId: RoomID? = null,
25+
) {
26+
init {
27+
require(name.isNotEmpty())
28+
require(description.isNotEmpty())
29+
}
30+
31+
override fun equals(other: Any?): Boolean = when {
32+
other === this -> true
33+
other is MedicalTechnology -> this.id == other.id
34+
else -> false
35+
}
36+
37+
override fun hashCode(): Int = this.id.hashCode()
38+
}
39+
40+
/**
41+
* Identification of a [MedicalTechnology].
42+
* @param[value] the id.
43+
*/
44+
data class MedicalTechnologyID(val value: String) {
45+
init {
46+
// Constructor validation: The id must not be empty
47+
require(this.value.isNotEmpty())
48+
}
49+
}
50+
51+
/**
52+
* The type of [MedicalTechnology].
53+
*/
54+
enum class MedicalTechnologyType {
55+
/** Endoscope technology. */
56+
ENDOSCOPE,
57+
/** X-ray technology. */
58+
XRAY,
59+
}

0 commit comments

Comments
 (0)