restrict numeric card number to 0..9

This commit is contained in:
2025-03-17 18:23:52 +01:00
parent 48ac4156bd
commit 1d70f73061

View File

@@ -38,7 +38,12 @@ sealed interface Card {
@Serializable(with = UUIDSerializer::class) @Serializable(with = UUIDSerializer::class)
override val id: UUID = UUID.randomUUID(), override val id: UUID = UUID.randomUUID(),
) : Card, ) : Card,
ColorCard ColorCard {
init {
if (number > 9) error("Card number cannot be greater of 9")
if (number < 0) error("Card number cannot be lower of 0")
}
}
sealed interface Special : Card sealed interface Special : Card