package report

import "github.com/google/uuid"

// MessageTypeUserGamesReport is the authenticated gateway message type
// used to fetch a per-player turn report through
// `GET /api/v1/user/games/{game_id}/reports/{turn}`. The signed payload
// is a FlatBuffers `GameReportRequest`; the response is a FlatBuffers
// `Report`.
const MessageTypeUserGamesReport = "user.games.report"

// MessageTypeUserGamesBattle is the authenticated gateway message type
// used to fetch one battle report through
// `GET /api/v1/user/games/{game_id}/battles/{turn}/{battle_id}`. The
// signed payload is a FlatBuffers `GameBattleRequest`; the response is
// a FlatBuffers `BattleReport`.
const MessageTypeUserGamesBattle = "user.games.battle"

// GameReportRequest is the typed payload of MessageTypeUserGamesReport.
// `GameID` selects the target game (the message_type alone is not
// enough; this scope is per-game) and `Turn` selects the requested
// turn number. Both fields are required.
type GameReportRequest struct {
	// GameID identifies the game whose report is fetched.
	GameID uuid.UUID `json:"game_id"`

	// Turn is the zero-based turn number whose report is requested.
	Turn uint `json:"turn"`
}

// GameBattleRequest is the typed payload of MessageTypeUserGamesBattle.
// `GameID` selects the target game; `Turn` is the turn the battle
// happened at (the engine partitions battles by turn for cheap lookup);
// `BattleID` is the in-game identifier returned in the report's
// battle-summary list. All three fields are required.
type GameBattleRequest struct {
	// GameID identifies the game the battle belongs to.
	GameID uuid.UUID `json:"game_id"`

	// Turn is the turn number the battle happened at.
	Turn uint `json:"turn"`

	// BattleID is the engine-assigned id of the battle to fetch.
	BattleID uuid.UUID `json:"battle_id"`
}
