foyer-dsi-assure-2035/core/src/lu/foyer/clients/ClientCommand.scala

31 lines
913 B
Scala
Raw Normal View History

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