2025-02-27 18:45:46 +01:00
|
|
|
package lu.foyer
|
|
|
|
|
package clients
|
|
|
|
|
|
|
|
|
|
import zio.schema.*
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDate
|
2025-02-28 05:40:32 +01:00
|
|
|
import zio.schema.annotation.discriminatorName
|
2025-02-27 18:45:46 +01:00
|
|
|
|
2025-02-28 05:40:32 +01:00
|
|
|
@discriminatorName("eventType")
|
2025-02-27 18:45:46 +01:00
|
|
|
enum ClientEvent derives Schema:
|
|
|
|
|
case Created(
|
|
|
|
|
lastName: ClientLastName,
|
|
|
|
|
firstName: ClientFirstName,
|
|
|
|
|
birthDate: ClientBirthDate,
|
|
|
|
|
drivingLicenseDate: Option[ClientDrivingLicenseDate],
|
|
|
|
|
phoneNumber: Option[PhoneNumberInput],
|
|
|
|
|
email: Option[Email],
|
|
|
|
|
address: Option[Address])
|
|
|
|
|
case Updated(
|
|
|
|
|
lastName: Option[ClientLastName],
|
|
|
|
|
firstName: Option[ClientFirstName],
|
|
|
|
|
birthDate: Option[ClientBirthDate],
|
|
|
|
|
drivingLicenseDate: Option[ClientDrivingLicenseDate],
|
|
|
|
|
phoneNumber: Option[PhoneNumberInput],
|
|
|
|
|
email: Option[Email],
|
|
|
|
|
address: Option[Address])
|
2025-02-28 05:40:32 +01:00
|
|
|
case Disabled(reason: ClientDisabledReason)
|
|
|
|
|
|
|
|
|
|
object ClientEvent:
|
|
|
|
|
given Schema[ClientEvent.Created] = DeriveSchema.gen
|
|
|
|
|
given Schema[ClientEvent.Updated] = DeriveSchema.gen
|
|
|
|
|
given Schema[ClientEvent.Disabled] = DeriveSchema.gen
|