package types

var (
	// 用户数据
	MSG_SUCCESS          = &CodeState{Code: 0, Msg: "success"}        //注册成功
	MSG_Register_Existed = &CodeState{Code: 1, Msg: "existed user"}   //注册用户已存在
	MSG_Login_Error      = &CodeState{Code: 2, Msg: "login fail"}     //登录失败 信息错误
	MSG_Version_Error    = &CodeState{Code: 3, Msg: "version wrong"}  //版本号不对
	MSG_User_Not_Exist   = &CodeState{Code: 4, Msg: "user not exist"} //用户不存在
	MSG_DB_Error         = &CodeState{Code: 111, Msg: "db error"}     //数据库出错

	//房间错误信息 1000开始标记
	MSG_ROOM_NOTAUTH    = &CodeState{Code: 1001, Msg: "Unauthorized"}     //没有权限
	MSG_ROOM_ERRORPWD   = &CodeState{Code: 1002, Msg: "pwd wrong"}        //密码错误
	MSG_ROOM_OVERVOLUME = &CodeState{Code: 1003, Msg: "aleady in room"}   //你已经在其他房间了 拒绝加入其他房间
	MSG_ROOM_NOMONEY    = &CodeState{Code: 1004, Msg: "not enough money"} //起始资金不够
	MSG_ROOM_NOTEMPTY   = &CodeState{Code: 1005, Msg: "room not empty"}   //房子不空
	MSG_ROOM_NOROOM     = &CodeState{Code: 1006, Msg: "no room"}          //没有该房子记录
	MSG_ROOM_FULL       = &CodeState{Code: 1007, Msg: "room full"}        // 房间已满
	MSG_NOT_IN_ROOM     = &CodeState{Code: 1008, Msg: "not in room"}      // 你不在房间
	MSG_ROOM_CLOSED     = &CodeState{Code: 1009, Msg: "room closed"}      // 房间已经关闭
	MSG_NOT_TURN        = &CodeState{Code: 1010, Msg: "not your turn"}    // 没轮到你下注
	MSG_NOT_NOT_START   = &CodeState{Code: 1011, Msg: "game not start"}   // 游戏未开始不能下注
)

// 玩家提交下注数据
// 有四种下注方式，下注数分别对应为：
// 弃牌: <0 (fold)
// 跟注：等于单注额 (call)
// 看注：= 0 表示看注 (check)
// 加注：大于单注额 (raise)
// 全押：等于玩家手中所有筹码 (allin)
type Bet struct {
	Value int32
}

type CodeState struct {
	Code int    // const
	Msg  string //警告信息
	Data interface{}
}

type SitDown struct {
	Uid int64
	Pos uint8
}

type StandUp struct {
	Uid int64
}
type LeaveRoom struct {
	RoomNumber string
	Uid        int64
}
type Pot struct {
	Pot []uint32 `json:"pot"`
}

type PreFlop struct {
	Cards []byte `json:"cards"`
	Kind  uint8  `json:"kind"`
}

type Flop struct {
	Cards []byte `json:"cards"`
	Kind  uint8  `json:"kind"`
}

type River struct {
	Card byte  `json:"card"`
	Kind uint8 `json:"kind"`
}

type CommonRound struct {
	Card []byte `json:"card"`
	Kind uint8  `json:"kind"`
}

type Button struct {
	Uid int64 `json:"uid"`
}

// BetPrompt 提示指定的玩家下注
type BetPrompt struct {
}

// BetBroadcast 通报玩家下注
type BetBroadcast struct {
	Value int32
	Kind  string
	Uid   int64
}

type Turn struct {
	Card byte  `json:"card"`
	Kind uint8 `json:"kind"`
}

type RoomInfo struct {
	Number    int64
	Volume    uint8
	GameType  uint32 //游戏类型 即玩法
	PayValue  uint8  //倍数
	BaseMoney uint32 //最低资本 才能进房间
	RoomPwd   string //房间锁--密码
	RoomID    uint32

	SB       uint32   // 小盲注
	BB       uint32   // 大盲注
	Cards    []byte   //公共牌
	Pot      []uint32 // 当前奖池筹码数
	Timeout  uint8    // 倒计时超时时间(秒)
	Button   uint8    // 当前庄家座位号，从1开始
	Chips    []uint32 // 玩家本局下注的总筹码数，与occupants一一对应
	Bet      uint32   // 当前下注额
	Max      uint8    // 房间最大玩家人数
	MaxChips uint32
	MinChips uint32
}
type UserInfo struct {
	Uid      int64  // 用户id
	Username string // 客户端玩家展示的账号
	Nickname string // 微信昵称
	Sex      int8   // 微信性别 0-未知，1-男，2-女
	Profile  string // 微信头像
	Chips    uint32 // 筹码
	Pos      uint8  // 筹码
}

type JoinRoom struct {
	Uid        int64
	RoomNumber string
	RoomPwd    string
}
type WSMessage struct {
	Type string      `json:"type"` // 消息类型：如 "join", "bet", "fold", "Msg",翻牌
	Data interface{} `json:"data"` // 消息内容，具体格式根据 Type 决定
	Rid  int64
	Uid  int64
}
type JoinRoomBroadcast struct {
	UserInfo *UserInfo `json:"userInfo"`
}

type Chat struct {
	Uid  uint32
	Text string
}
