2025-09-17 19:30:17 +07:00
|
|
|
package models
|
|
|
|
|
|
|
|
|
|
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"`
|
2026-09-30 12:20:42 +07:00
|
|
|
CoinsUsed int `json:"coins_used" validate:"min=0"`
|
2025-09-17 19:30:17 +07:00
|
|
|
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"`
|
2026-09-30 12:20:42 +07:00
|
|
|
CoinsUsed int `json:"coins_used"`
|
2025-09-17 19:30:17 +07:00
|
|
|
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 ListGamePlaysQuery struct {
|
|
|
|
|
Page int `query:"page" validate:"min=1"`
|
|
|
|
|
Limit int `query:"limit" validate:"min=1,max=100"`
|
|
|
|
|
Search string `query:"search"`
|
|
|
|
|
GameID *uuid.UUID `query:"game_id"`
|
|
|
|
|
CustomerID *uuid.UUID `query:"customer_id"`
|
|
|
|
|
PrizeID *uuid.UUID `query:"prize_id"`
|
2026-09-30 12:20:42 +07:00
|
|
|
SortBy string `query:"sort_by" validate:"omitempty,oneof=created_at coins_used token_used"`
|
2025-09-17 19:30:17 +07:00
|
|
|
SortOrder string `query:"sort_order" validate:"omitempty,oneof=asc desc"`
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-30 12:20:42 +07:00
|
|
|
// PlayGameRequest plays a game for a customer, at the game's metadata.coin_cost.
|
2025-09-17 19:30:17 +07:00
|
|
|
type PlayGameRequest struct {
|
|
|
|
|
GameID uuid.UUID `json:"game_id" validate:"required"`
|
|
|
|
|
CustomerID uuid.UUID `json:"customer_id" validate:"required"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type PlayGameResponse struct {
|
2026-09-30 12:20:42 +07:00
|
|
|
GamePlay GamePlayResponse `json:"game_play"`
|
|
|
|
|
PrizeWon *GamePrizeResponse `json:"prize_won,omitempty"`
|
|
|
|
|
CoinsRemaining int64 `json:"coins_remaining"`
|
2025-09-17 19:30:17 +07:00
|
|
|
}
|