59 lines
2.1 KiB
Go
59 lines
2.1 KiB
Go
|
|
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"`
|
||
|
|
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 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 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"`
|
||
|
|
}
|
||
|
|
|
||
|
|
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"`
|
||
|
|
}
|