51 lines
1.8 KiB
Go
51 lines
1.8 KiB
Go
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"`
|
|
TokenUsed int `json:"token_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"`
|
|
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 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"`
|
|
SortBy string `query:"sort_by" validate:"omitempty,oneof=created_at token_used"`
|
|
SortOrder string `query:"sort_order" validate:"omitempty,oneof=asc desc"`
|
|
}
|
|
|
|
type PlayGameRequest struct {
|
|
GameID uuid.UUID `json:"game_id" validate:"required"`
|
|
CustomerID uuid.UUID `json:"customer_id" validate:"required"`
|
|
TokenUsed int `json:"token_used" validate:"min=0"`
|
|
}
|
|
|
|
type PlayGameResponse struct {
|
|
GamePlay GamePlayResponse `json:"game_play"`
|
|
PrizeWon *GamePrizeResponse `json:"prize_won,omitempty"`
|
|
TokensRemaining int64 `json:"tokens_remaining"`
|
|
}
|