cards dto

mail@pastecode.io avatar
unknown
plain_text
2 years ago
801 B
2
Indexable
Never

typealias Magnitude = Int

enum class CardSuit {
    HEARTS,
    CLUBS,
    DIAMONDS,
    SPADES
}

data class Card(
    val suit: CardSuit,
    val magnitude: Magnitude
)

data class User(
    val id: String,
    val name: String,
    val email: String,
)

data class Player(
    val id: String,
    val user: User,
    val cards: List<Card>,
    val points: Int,
)

sealed class GameState {
    object Prepared: GameState()
    object Started: GameState()
    object Paused: GameState()
    // todo вот тут надо что-то добавить наверное про переключение игр
    object Finished(winner: Player): GameState()
}

data class FieldState(
    val deck: List<Card>, // на клиентах тут Stack или LinkedList
    val players: List<Player>,
)