package contract import ( "time" "github.com/google/uuid" ) type CreateGamePlayRequest struct { GameID uuid.UUID `json:"game_id" validate:"required"` CustomerID uuid.UUID `json:"customer_id" validate:"required"` CoinsUsed int `json:"coins_used" validate:"min=0"` RandomSeed *string `json:"random_seed,omitempty"` } type GamePlayResponse struct { ID uuid.UUID `json:"id"` GameID uuid.UUID `json:"game_id"` CustomerID uuid.UUID `json:"customer_id"` PrizeID *uuid.UUID `json:"prize_id,omitempty"` CoinsUsed int `json:"coins_used"` // Deprecated: the same as CoinsUsed, kept until the apps read coins_used. TokenUsed int `json:"token_used"` RandomSeed *string `json:"random_seed,omitempty"` CreatedAt time.Time `json:"created_at"` Game *GameResponse `json:"game,omitempty"` Customer *CustomerResponse `json:"customer,omitempty"` Prize *GamePrizeResponse `json:"prize,omitempty"` } type ListGamePlaysRequest struct { Page int `json:"page" validate:"min=1"` Limit int `json:"limit" validate:"min=1,max=100"` Search string `json:"search"` GameID *uuid.UUID `json:"game_id"` CustomerID *uuid.UUID `json:"customer_id"` PrizeID *uuid.UUID `json:"prize_id"` SortBy string `json:"sort_by" validate:"omitempty,oneof=created_at coins_used token_used"` SortOrder string `json:"sort_order" validate:"omitempty,oneof=asc desc"` } type PaginatedGamePlaysResponse struct { Data []GamePlayResponse `json:"data"` TotalCount int `json:"total_count"` Page int `json:"page"` Limit int `json:"limit"` TotalPages int `json:"total_pages"` } // PlayGameRequest plays a game for a customer. What it costs is the game's // metadata.coin_cost (docs/prd-point-coin.md F8), never the caller's choice. type PlayGameRequest struct { GameID uuid.UUID `json:"game_id" validate:"required"` CustomerID uuid.UUID `json:"customer_id" validate:"required"` } type PlayGameResponse struct { GamePlay GamePlayResponse `json:"game_play"` PrizeWon *GamePrizeResponse `json:"prize_won,omitempty"` CoinsRemaining int64 `json:"coins_remaining"` // Deprecated: the same as CoinsRemaining, kept until the apps read coins_remaining. TokensRemaining int64 `json:"tokens_remaining"` }