Skip to content

Commit

Permalink
chore: add implantable medical device concept
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaGiulianelli committed May 10, 2023
1 parent 314d843 commit 2e83b47
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/main/kotlin/entity/medicaldevice/ImplantableMedicalDevice.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (c) 2023. Smart Operating Block
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
*/

package entity.medicaldevice

/**
* It describes an implantable medical device used during a surgery inside an Operating Room.
* It is identified by its [id] and it is of a particular [type].
*/
data class ImplantableMedicalDevice(
val id: ImplantableMedicalDeviceID,
val type: ImplantableMedicalDeviceType,
) {
override fun equals(other: Any?): Boolean = when {
other === this -> true
other is ImplantableMedicalDevice -> this.id == other.id
else -> false
}

override fun hashCode(): Int = this.id.hashCode()
}

/**
* Identification for [ImplantableMedicalDevice].
* @param[value] the id.
*/
data class ImplantableMedicalDeviceID(val value: String) {
init {
// Constructor validation: the id must not be empty
require(this.value.isNotEmpty())
}
}

/**
* The types of [ImplantableMedicalDevice].
*/
enum class ImplantableMedicalDeviceType {
/** The Catheter is an implantable medical device type. */
CATHETER,

/** The pacemaker is an implantable medical device type. */
PACEMAKER,
}

0 comments on commit 2e83b47

Please sign in to comment.