using System.Collections.Generic;
using MessagePack;
#if GameClient
using GameFramework;
#endif

namespace GameMessage
{
    /// <summary>
    /// 俱乐部桌子数据请求
    /// </summary>
    [Message(MessageCode.ClubDataAllDeskInfoRequest)]
    [MessagePackObject()]
    public class ClubDataAllDeskInfoRequest : MessageData
    {
        /// <summary>
        /// 俱乐部ID
        /// </summary>
        [Key(0)]
        public int ClubId;

        /// <summary>
        /// 桌子的版本
        /// </summary>
        [Key(1)]
        public ulong DeskVer;

#if GameClient
        public static ClubDataAllDeskInfoRequest Create(int clubId,ulong deskVer)
        {
            ClubDataAllDeskInfoRequest request = ReferencePool.Acquire<ClubDataAllDeskInfoRequest>();
            request.ClubId = clubId;
            request.DeskVer = deskVer;
            return request;
        }
#endif
    }

    /// <summary>
    /// 俱乐部桌子数据响应
    /// </summary>
    [Message(MessageCode.ClubDataAllDeskInfoResponse)]
    [MessagePackObject()]
    public class ClubDataAllDeskInfoResponse : MessageData
    {
        [Key(0)]
        public int ClubId;
        
        [Key(1)]
        public ulong DeskVer;
        
        [Key(2)]
        public List<ClubDeskInfo> DeskInfos;
    }

    [Message(MessageCode.KickOutPlayerOfDeskRequest)]
    [MessagePackObject()]
    public class KickOutPlayerOfDeskRequest : MessageData
    {
        [Key(0)]public int ClubId; 
        [Key(1)]public int RoomNum; 
        [Key(2)]public string Weiyima;
        [Key(3)]public int UserId; 
        
#if GameClient
        public static KickOutPlayerOfDeskRequest Create(int clubId, int userId, int roomNum, string weiyima)
        {
            KickOutPlayerOfDeskRequest request = ReferencePool.Acquire<KickOutPlayerOfDeskRequest>();
            request.ClubId = clubId;
            request.RoomNum = roomNum;
            request.Weiyima = weiyima;
            request.UserId = userId;
            return request;
        }
#endif
    }
    
    [Message(MessageCode.KickOutPlayerOfDeskResponse)]
    [MessagePackObject()]
    public class KickOutPlayerOfDeskResponse : MessageData
    {
        [Key(0)]public int ClubId; 
        [Key(1)]public int UserId;
        [Key(2)]public int Code;
    }

    [MessagePackObject()]
    public class ClubDeskInfo
    {
        /// <summary>
        /// 唯一码 桌子的唯一码
        /// </summary>
        [Key(0)]
        public string Weiyima;

        /// <summary>
        /// 房间号 6位房间码
        /// </summary>
        [Key(1)]
        public string RoomNum;

        /// <summary>
        /// 当前场次 从1开始
        /// </summary>
        [Key(2)]
        public int NowCnt;

        /// <summary>
        /// 结束的场次
        /// </summary>
        [Key(3)]
        public int OverCnt;

        /// <summary>
        /// 创建类型 0 普通 1 代开房间 5 竞技比赛房间
        /// </summary>
        [Key(4)]
        public int CreateType;

        /// <summary>
        /// 创建房间的id 如果是普通创建的房间 则此id为玩家的userid   竞技比赛创建则为竞技比赛id
        /// </summary>
        [Key(5)]
        public int CreateId;

        /// <summary>
        /// 所属玩法的唯一码
        /// </summary>
        [Key(6)]
        public string WayWeiyima;

        /// <summary>
        /// 玩家数据
        /// </summary>
        [Key(7)]
        public DeskPlayerDataPack[] Players;
    }

    // [MessagePackObject()]
    // public class MessageTest1
    // {
    //     [Key(0)]
    //     public int a;
    //
    //     [Key(1)]
    //     public int b;
    //
    //     [Key(2)]
    //     public List<int> c;
    //
    //     [Key(3)]
    //     public MessageTest2 d;
    //     
    //     [Key(4)]
    //     public string e;
    // }
    //
    // [MessagePackObject()]
    // public class MessageTest2
    // {
    //     [Key(0)]
    //     public int a;
    //
    //     [Key(1)]
    //     public string b;
    //
    //     [Key(2)]
    //     public int d;
    //
    //     [Key(3)]
    //     public List<int> e;
    // }
}