package game

const (
	StatusActive      = "active"
	StatusMaintenance = "maintenance"
	StatusDisabled    = "disabled"

	SceneVoiceRoom = "voice_room"

	LaunchModeH5Popup = "h5_popup"
	SessionActive     = "active"

	OrderStatusWalletApplying = "wallet_applying"
	OrderStatusSucceeded      = "succeeded"
	OrderStatusFailed         = "failed"
	OrderStatusConflict       = "conflict"
)

// Platform 是第三方游戏平台配置事实。
type Platform struct {
	AppCode      string
	PlatformCode string
	PlatformName string
	Status       string
	APIBaseURL   string
	SortOrder    int32
	CreatedAtMS  int64
	UpdatedAtMS  int64
}

// CatalogItem 是内部稳定 game_id 到第三方 provider_game_id 的映射。
type CatalogItem struct {
	AppCode        string
	GameID         string
	PlatformCode   string
	ProviderGameID string
	GameName       string
	Category       string
	IconURL        string
	CoverURL       string
	LaunchMode     string
	Orientation    string
	MinCoin        int64
	Status         string
	SortOrder      int32
	Tags           []string
	CreatedAtMS    int64
	UpdatedAtMS    int64
}

// AppGame 是 App 语音房内看到的跨平台合并游戏卡片。
type AppGame struct {
	GameID       string
	PlatformCode string
	NameKey      string
	Name         string
	IconURL      string
	CoverURL     string
	Category     string
	LaunchMode   string
	Orientation  string
	MinCoin      int64
	Enabled      bool
	Maintenance  bool
	SortOrder    int32
}

// LaunchableGame 汇总启动时需要的平台和目录配置。
type LaunchableGame struct {
	CatalogItem
	PlatformName   string
	PlatformStatus string
	APIBaseURL     string
}

// LaunchSession 是 H5 启动会话持久事实，token 只保存 hash。
type LaunchSession struct {
	AppCode         string
	SessionID       string
	UserID          int64
	DisplayUserID   string
	RoomID          string
	Scene           string
	PlatformCode    string
	GameID          string
	ProviderGameID  string
	LaunchTokenHash string
	Status          string
	ExpiresAtMS     int64
	CreatedAtMS     int64
	UpdatedAtMS     int64
}

// GameOrder 是 provider_order_id 对应的钱包改账事实。
type GameOrder struct {
	AppCode             string
	OrderID             string
	PlatformCode        string
	ProviderOrderID     string
	ProviderRoundID     string
	GameID              string
	ProviderGameID      string
	UserID              int64
	RoomID              string
	OpType              string
	CoinAmount          int64
	Status              string
	WalletTransactionID string
	WalletBalanceAfter  int64
	RequestHash         string
	FailureCode         string
	FailureMessage      string
	CreatedAtMS         int64
	UpdatedAtMS         int64
}

// CallbackLog 保存平台回调审计摘要，原始 body 后续可迁移到对象存储。
type CallbackLog struct {
	AppCode           string
	CallbackID        string
	PlatformCode      string
	Operation         string
	RequestID         string
	ProviderRequestID string
	SignatureValid    bool
	RequestHash       string
	ResponseCode      string
	ResponseBodyHash  string
	Status            string
	CreatedAtMS       int64
}
