From ab73e42fa404f487a39ebb33f76fb95ab9c3dc56 Mon Sep 17 00:00:00 2001 From: Andrea Giulianelli Date: Tue, 9 May 2023 17:33:36 +0200 Subject: [PATCH] chore: add simple surgical process concept --- .../kotlin/entity/process/SurgicalProcess.kt | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/main/kotlin/entity/process/SurgicalProcess.kt diff --git a/src/main/kotlin/entity/process/SurgicalProcess.kt b/src/main/kotlin/entity/process/SurgicalProcess.kt new file mode 100644 index 0000000..5f8c7dc --- /dev/null +++ b/src/main/kotlin/entity/process/SurgicalProcess.kt @@ -0,0 +1,37 @@ +/* + * 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.process + +/** + * It describes a surgical process that is happened inside the Operating Block. + * Each process is identified by its [id] and it has a [type] that describes it. + */ +data class SurgicalProcess( + val id: SurgicalProcessID, + val type: String, +) { + override fun equals(other: Any?): Boolean = when { + other === this -> true + other is SurgicalProcess -> this.id == other.id + else -> false + } + + override fun hashCode(): Int = this.id.hashCode() +} + +/** + * Identification of a [SurgicalProcess]. + * @param[value] the id. + */ +data class SurgicalProcessID(val value: String) { + init { + // Constructor validation: The id must not be empty + require(this.value.isNotEmpty()) + } +}