package protocol

type MessageHeader struct {
	PackageLen uint16
	MsgID      uint16
	Seq        uint32
	PlayerID   uint32
	RoomID     uint32
}


 /////////////////////手牌回放信息////////////////////////
 type ReplayRoomInfo struct{
	GameType string  `json:"type"`
	Mode uint32 `json:"mode"`
	Blind uint32 `json:"blind"`
	Ante uint32 `json:"ante"`
	PlayerCount uint32 `json:"players_count"`
	DoubleAnte bool `json:"double_ante"`
}
type ReplayTableInfo struct{
    DealerSeat int `json:"dealer_seat"`
    SBSeat int `json:"sb_seat"`
    BBSeat int `json:"bb_seat"`
    StraddleSeat int `json:"straddle_seat"`
	PostSeats []uint32 `json:"post_seats"`
	ShowDownSeats []uint32 `json:"showdown_seats"`
}
type SeatInfo struct{
	SeatNo uint32  `json:"seat_no"`
	UID uint32
	Name string  `json:"name"`
	Head string  `json:"head_url"`
	Stake uint32  `json:"stake"`
	HoleCards [] *CardItem  `json:"holecards"`
	SeatLabel string  `json:"label"`
	IsMuck bool  `json:"is_muck"`	
}
type ReplaySeatsInfo struct{
	Seats []*SeatInfo `json:"seats_info"`
}
type ReplayPotInfo struct{
	PotID uint32 `json:"pot_id"`
	Amount uint32 `json:"amount"`
}
type EndRoundInfo struct{
	Pots []*ReplayPotInfo `json:"pots_info"`
}
func (e *EndRoundInfo)Reset(){
	e.Pots = e.Pots[:0]
}
type ActionInfo struct{
	Seq uint32 `json:"seq"`
	SeatNo uint32 `json:"seat_no"`
	ActionType uint32 `json:"action_type"`
	Amount uint32 `json:"amount"`
}

type SettleInfo struct{
	SeatNo uint32 `json:"win_seat_no"`
	WinAmount int32 `json:"win_amount"`
}

type ReplayRoundsInfo struct{
	AnteRound bool `json:"ante_round"`
	EndAnteRound EndRoundInfo `json:"end_ante_round"`
	
	BlindRound bool `json:"blind_round"`
	Preflop []*ActionInfo  `json:"preflop"`
	EndPreflopRound EndRoundInfo `json:"end_preflop_round"`
	
	FlopCommunityCards []*CardItem `json:"flop_community_cards"`
	Flop []*ActionInfo  `json:"flop"`
	EndFlopRound EndRoundInfo `json:"end_flop_round"`
	
	TurnCommunityCard *CardItem  `json:"turn_community_card"`
	Turn []*ActionInfo  `json:"turn"`
	EndTurnRound EndRoundInfo `json:"end_turn_round"`

	RiverCommunityCard *CardItem  `json:"river_community_card"`
	River []*ActionInfo  `json:"river"`
	EndRiverRound EndRoundInfo `json:"end_river_round"`

	Settles []*SettleInfo `json:"settlement_round"`
}

func (r *ReplayRoundsInfo)Reset(){
	r.EndAnteRound.Reset()
	r.EndPreflopRound.Reset()
	r.EndFlopRound.Reset()
	r.EndTurnRound.Reset()
	r.EndRiverRound.Reset()

	r.Preflop = r.Preflop[:0]
	r.Flop = r.Flop[:0]
	r.Turn = r.Turn[:0]
	r.River = r.River[:0]
	r.TurnCommunityCard = nil
	r.RiverCommunityCard = nil
	
	r.FlopCommunityCards = r.FlopCommunityCards[:0]

	r.Settles = r.Settles[:0]
}

type HandReplayInfo struct{
	RoomInfo *ReplayRoomInfo
	TableInfo *ReplayTableInfo
	SeatsInfo *ReplaySeatsInfo
	RoundsInfo *ReplayRoundsInfo
}
func (h *HandReplayInfo) Init(){
	h.RoomInfo = new(ReplayRoomInfo)
	h.TableInfo = new(ReplayTableInfo)
	h.SeatsInfo = new(ReplaySeatsInfo)
	h.RoundsInfo = new(ReplayRoundsInfo)
}