49 lines
1.2 KiB
Scala
49 lines
1.2 KiB
Scala
|
|
package lu.foyer
|
||
|
|
package clients
|
||
|
|
|
||
|
|
import zio.schema.*
|
||
|
|
|
||
|
|
import java.time.Instant
|
||
|
|
import java.time.LocalDate
|
||
|
|
|
||
|
|
opaque type ClientLastName <: String = String
|
||
|
|
object ClientLastName extends NonBlankString[ClientLastName]
|
||
|
|
|
||
|
|
opaque type ClientFirstName <: String = String
|
||
|
|
object ClientFirstName extends NonBlankString[ClientFirstName]
|
||
|
|
|
||
|
|
opaque type ClientBirthDate <: LocalDate = LocalDate
|
||
|
|
object ClientBirthDate extends RefinedLocalDate[ClientBirthDate]
|
||
|
|
|
||
|
|
opaque type ClientDrivingLicenseDate <: LocalDate = LocalDate
|
||
|
|
object ClientDrivingLicenseDate extends RefinedLocalDate[ClientDrivingLicenseDate]
|
||
|
|
|
||
|
|
opaque type Email <: String = String
|
||
|
|
object Email extends NonBlankString[Email]
|
||
|
|
|
||
|
|
opaque type NationalNumber <: String = String
|
||
|
|
object NationalNumber extends NonBlankString[NationalNumber]
|
||
|
|
|
||
|
|
case class Client(
|
||
|
|
lastName: ClientFirstName,
|
||
|
|
firstName: ClientLastName,
|
||
|
|
drivingLicenseDate: ClientDrivingLicenseDate,
|
||
|
|
phoneNumber: PhoneNumber,
|
||
|
|
email: Email,
|
||
|
|
address: Address)
|
||
|
|
derives Schema
|
||
|
|
|
||
|
|
case class PhoneNumber(
|
||
|
|
country: Country,
|
||
|
|
nationalNumber: NationalNumber,
|
||
|
|
lastVerifiedAt: Option[Instant])
|
||
|
|
derives Schema
|
||
|
|
|
||
|
|
case class PhoneNumberInput(
|
||
|
|
country: Country,
|
||
|
|
nationalNumber: String)
|
||
|
|
derives Schema
|
||
|
|
|
||
|
|
enum ClientDisabledReason derives Schema:
|
||
|
|
case GDPR, Death
|