package protocol

// Enum Definitions
type GameStatus int32

const (
	GameStatus_RESERVED              GameStatus = 0
	GameStatus_IN_PROGRESS           GameStatus = 1
	GameStatus_OVER                  GameStatus = 2
	GameStatus_NOT_STARTED           GameStatus = 3
	GameStatus_ABORTED               GameStatus = 4
	GameStatus_OUTCOME               GameStatus = 5
	GameStatus_PLAYER_TIMEOUT        GameStatus = 6
	GameStatus_ABORTING              GameStatus = 7
	GameStatus_WAITING_INVITATION    GameStatus = 8
	GameStatus_FIRST_USER_DATA_ROUND GameStatus = 9
	GameStatus_SIMULTANEOUS          GameStatus = 10
	GameStatus_INTERRUPTIBLE         GameStatus = 11
)

type ErrorCode int32

const (
	ErrorCode_NO_ERROR ErrorCode = 0
)

// Message Definitions

type GameConfiguration struct {
	Name              string
	Private           bool
	Lurkable          bool
	Rated             bool
	MinPlayers        int32
	MaxPlayers        int32
	MinKarma          int32
	FirstPlayer       int32
	GameMode          int32
	Timeout           int32
	Data              []byte
	ReqFirstUserRound bool
	ObservableBy      int32
	MinRankScore      int32
	MainVariant       string
	RulesVer          int32
	IdleTime          int32
}

type Player struct {
	Id        int32
	Name      string
	Karma     int32
	RankScore float64
	Rank      int32
	NbGames   int32
	Language  int32
	Avatar    string // Simplified for mock
	Tz        string
}

type SmallPlayer struct {
	WWWId     int64
	Name      string
	Karma     int32
	RankScore float64
	Rank      int32
	NbGames   int32
	Language  int32
	Avatar    string
}

type GameDetails struct {
	GameId        int64
	Players       []*Player
	Configuration *GameConfiguration
	Data          []byte
	UserData      []*PlayerPregameData
}

type PlayerPregameData struct {
	PlayerId int32
	Data     []byte
}

type StatusReport struct {
	GameId        int64
	Status        GameStatus
	Data          []byte
	TurnId        int32
	NextPlayerIds []int32
	Players       []*Player
	Configuration *GameConfiguration
	ActivePlayer  int32
	// Add other fields as needed
}

type Session struct {
	Id int64
}

// Request/Response Wrappers (Simplification: We handle fields manually in codec mostly,
// but these structs represent the data content)

type AsyncConnectedRequest struct {
	Session *Session
	Player  *Player
}

type ServerStatisticsRequest struct {
	HostedGames      int32
	Players          int32
	ConnectedPlayers int32
}

type LobbyGameCreatedRequest struct {
	Game *GameDetails
}

// Helper: Encode helpers can be added here or in codec.
// For now, these structs serve as the 'definitions' requested by the user.
