package baseroom

type SeatStatus int

const (
	SsWaitStart  SeatStatus = 0 // 等待开始
	SsReadyStart SeatStatus = 1 // 准备
	SsPlaying    SeatStatus = 2 // 游戏中
	SsFakeLeave  SeatStatus = 3 // 假离开
)

func (t SeatStatus) String() string {
	switch t {
	case SsWaitStart:
		return "wait-start"
	case SsReadyStart:
		return "ready-start"
	case SsPlaying:
		return "playing"
	case SsFakeLeave:
		return "fake-leave"
	}
	return "not-exist-seat-status"
}

type BaseSeat struct {
	no     int
	player IPlayer
	status SeatStatus
}

func NewBaseSeat(no int) *BaseSeat {
	return &BaseSeat{
		no:     no,
		status: SsWaitStart,
	}
}

func (s *BaseSeat) No() int {
	return s.no
}

func (s *BaseSeat) Empty() bool {
	return s.player == nil
}

func (s *BaseSeat) Player() IPlayer {
	return s.player
}

func (s *BaseSeat) SetPlayer(player IPlayer) {
	s.player = player
}

func (s *BaseSeat) Status() SeatStatus {
	return s.status
}

func (s *BaseSeat) SetStatus(status SeatStatus) {
	s.status = status
}
