package common

import (
	"net"
	"sync"
)

type PlayerGameActionType int

const (
	Enum_Game_Action_None PlayerGameActionType = iota
	Enum_Game_Action_ResetAction

	Enum_Game_Action_Check
	Enum_Game_Action_Fold
	Enum_Game_Action_Call
	Enum_Game_Action_Bet
	Enum_Game_Action_Raise
	Enum_Game_Action_Allin

	Enum_Game_Action_Show
	Enum_Game_Action_Muck

	Enum_Game_Action_Sitout
	Enum_Game_Action_Back
)

type SchedAction struct {
	valid  bool
	amount int
	action PlayerGameActionType
}

type GamePlayer struct {
	UID        int
	Conn       net.Conn
	ConnLocker *sync.RWMutex //conn设置保护
	OutChannel chan []byte
	OutDone    chan bool
	ConnSeq    uint32
	ConningSeq uint32
}

func (player *GamePlayer) UpdateConn(conn net.Conn) {
	player.ConnLocker.Lock()
	defer player.ConnLocker.Unlock()
	player.Conn = conn
}

type GameType int32

const (
	Enum_Game_Type_None         GameType = 0
	Enum_Game_Type_Normal       GameType = 1
	Enum_Game_Type_Club         GameType = 2
	Enum_Game_Type_Special_Club GameType = 3
)

type GameMode int32

const (
	Enum_Game_Mode_None   GameMode = 0
	Enum_Game_Mode_Normal GameMode = 1
	Enum_Game_Mode_Match  GameMode = 2
	Enum_Game_Mode_Other  GameMode = 3
)

type PlayerRemark struct {
	Uid     uint32 `json:"uid"`
	Type    int32  `json:"type"`
	Remarks string `json:"remark"`
}
