Skip to content

Commit

Permalink
chore: add model data for room entity
Browse files Browse the repository at this point in the history
  • Loading branch information
andrea-acampora committed Mar 24, 2023
1 parent 464f585 commit ebfec5b
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/main/kotlin/entity/room/Room.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* 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.room

/** The model of a Room of the Operating Block composed by:
* - the [id] of the room,
* - the [name] of the room,
* - the [type] of the room.
*/
data class Room(
val id: RoomData.RoomId,
val name: String?,
val type: RoomData.RoomType
) {
override fun equals(other: Any?): Boolean = when {
other === this -> true
other is Room -> this.id == other.id
else -> false
}

override fun hashCode(): Int = this.id.hashCode()
}
27 changes: 27 additions & 0 deletions src/main/kotlin/entity/room/RoomData.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* 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.room

/** Module with all data necessary for Operating Block [Room]. */
object RoomData {

/** The [id] of a [Room]. */
data class RoomId(val id: String) {
init {
require(this.id.isNotEmpty()) {
"Room ID can not be empty!"
}
}
}

/** The possible type of [Room]. */
enum class RoomType {
PRE_POST_OPERATING_ROOM, OPERATING_ROOM
}
}

0 comments on commit ebfec5b

Please sign in to comment.