Skip to content

Commit

Permalink
chore: add healthcare user concept
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaGiulianelli committed May 9, 2023
1 parent 602c6c7 commit a25980b
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/main/kotlin/entity/healthcareuser/HealthcareUser.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* 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.healthcareuser

/**
* It represents a Healthcare user of the Healthcare national system.
* Each user is identified by their [taxCode] and has a [name] and a [surname].
*/
data class HealthcareUser(
val taxCode: TaxCode,
val name: String,
val surname: String,
) {
override fun equals(other: Any?): Boolean = when {
other === this -> true
other is HealthcareUser -> this.taxCode == other.taxCode
else -> false
}

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

/**
* Tax Code of a [HealthcareUser].
* @param[value] the tax code.
*/
data class TaxCode(val value: String) {
init {
// Constructor validation: the code must not be empty
require(this.value.isNotEmpty())
}
}

0 comments on commit a25980b

Please sign in to comment.