package chat

// RoomRole 聊天室成員角色
type RoomRole string

const (
	// RoomRoleMember 一般成員
	RoomRoleMember RoomRole = "member"
	// RoomRoleAdmin 管理員
	RoomRoleAdmin RoomRole = "admin"
	// RoomRoleOwner 擁有者
	RoomRoleOwner RoomRole = "owner"
)

// String 返回角色的字串表示
func (r RoomRole) String() string {
	return string(r)
}

// IsValid 檢查角色是否有效
func (r RoomRole) IsValid() bool {
	switch r {
	case RoomRoleMember, RoomRoleAdmin, RoomRoleOwner:
		return true
	default:
		return false
	}
}

// IsAdmin 檢查是否為管理員或擁有者
func (r RoomRole) IsAdmin() bool {
	return r == RoomRoleAdmin || r == RoomRoleOwner
}

// IsOwner 檢查是否為擁有者
func (r RoomRole) IsOwner() bool {
	return r == RoomRoleOwner
}
