using System;
using System.Collections.Generic;
using MessagePack;

#if GameClient
using GameFramework;
#endif

namespace GameMessage
{
    [Message(MessageCode.ClubFightRecordRequest)]
    [MessagePackObject]
    public class ClubFightRecordRequest : MessageData
    {
        /// <summary>
        /// 获取俱乐部Id
        /// </summary>
        [Key(0)] public int ClubId;

        /// <summary>
        /// 搜索房间号或者玩家ID
        /// </summary>
        [Key(1)] public int Number;

        /// <summary>
        /// 请求的日期
        /// </summary>
        [Key(2)] public long Day;

        /// <summary>
        /// 当前第几页
        /// </summary>
        [Key(3)] public int PageIndex;

        /// <summary>
        /// 一页展示几个
        /// </summary>
        [Key(4)] public int PageSize;

        /// <summary>
        /// 总页码
        /// </summary>
        [Key(5)] public int PageTotal;

#if GameClient
        public static ClubFightRecordRequest Create()
        {
            ClubFightRecordRequest request = ReferencePool.Acquire<ClubFightRecordRequest>();
            return request;
        }

        public override void Clear()
        {
            ClubId = 0;
            Number = 0;
            Day = 0;
            PageIndex = 0;
            PageSize = 0;
            PageTotal = 0;
        }
#endif
    }

    [Message(MessageCode.ClubFightRecordResponse)]
    [MessagePackObject]
    public class ClubFightRecordResponse : MessageData
    {
        [Key(0)] public List<ClubFightRecordInfo> ClubFightRecordInfos;
    }

    [Message(MessageCode.ClubFightRecordStatisticsRequest)]
    [MessagePackObject]
    public class ClubFightRecordStatisticsRequest : MessageData
    {
        [Key(0)] public int ClubId;

        [Key(1)] public ulong RecordVer;

        [Key(2)] public int StartId;

#if GameClient
        public static ClubFightRecordStatisticsRequest Create()
        {
            return ReferencePool.Acquire<ClubFightRecordStatisticsRequest>();
        }
#endif
    }

    [Message(MessageCode.ClubFightRecordStatisticsResponse)]
    [MessagePackObject]
    public class ClubFightRecordStatisticsResponse : MessageData
    {
        [Key(0)] public int ClubId;

        [Key(1)] public ulong RecordVer;

        [Key(2)] public int StartId;

        [Key(3)] public List<ClubFightRecordInfo> ClubFightRecordInfos;
    }

    [Message(MessageCode.ClubDoFightRecordRequest)]
    [MessagePackObject]
    public class ClubDoFightRecordRequest : MessageData
    {
        /// <summary>
        /// 桌子唯一码
        /// </summary>
        [Key(0)] public string Weiyima;
        /// <summary>
        /// 记录Id
        /// </summary>
        [Key(1)] public int RecordId;
        /// <summary>
        /// 游戏的服务器id
        /// </summary>
        [Key(2)] public int GameSerId;
        /// <summary>
        ///  时间
        /// </summary>
        [Key(3)] public DateTime Time;
        
#if GameClient
        public static ClubDoFightRecordRequest Create(string weiyima, int recordId, int gameSerId, DateTime time)
        {
            var request = ReferencePool.Acquire<ClubDoFightRecordRequest>();
            request.Weiyima = weiyima;
            request.RecordId = recordId;
            request.GameSerId = gameSerId;
            request.Time = time;
            return request;
        }
#endif
    }

    [Message(MessageCode.ClubDoFightRecordResponse)]
    [MessagePackObject]
    public class ClubDoFightRecordResponse : MessageData
    {
        /// <summary>
        /// 桌子唯一码
        /// </summary>
        [Key(0)] public string Weiyima;
        /// <summary>
        /// 记录Id
        /// </summary>
        [Key(1)] public int RecordId;
        /// <summary>
        /// 游戏的服务器id
        /// </summary>
        [Key(2)] public int GameSerId;
        /// <summary>
        ///  时间
        /// </summary>
        [Key(3)] public DateTime Time;
        /// <summary>
        /// 桌子信息
        /// </summary>
        [Key(4)]public DeskInfoPack DeskInfo;
    }

    [MessagePackObject]
    public class ClubFightRecordInfo
    {
        /// <summary>
        /// ID
        /// </summary>
        [Key(0)] public int Id;

        /// <summary>
        /// 俱乐部Id
        /// </summary>
        [Key(1)] public int ClubId;

        /// <summary>
        /// 玩法id
        /// 从int 改为string  之前也没有使用上。
        /// </summary>
        [Key(2)] public string WayId;

        /// <summary>
        /// 朋友房唯一码
        /// </summary>
        [Key(3)] public string WeiYiMa;

        /// <summary>
        /// 游戏的服务器id
        /// </summary>
        [Key(4)] public int GameSerId;

        /// <summary>
        /// 房间号
        /// </summary>
        [Key(5)] public int RoomNum;

        /// <summary>
        /// 开始时间
        /// </summary>
        [Key(6)] public long StartTime;

        /// <summary>
        /// 结束时间
        /// </summary>
        [Key(7)] public long EndTime;

        /// <summary>
        /// 开战次数
        /// </summary>
        [Key(8)] public int WarCnt;

        /// <summary>
        /// 打完多少盘
        /// </summary>
        [Key(9)] public int OverCnt;

        /// <summary>
        /// 耗卡数量  --xu add
        /// </summary>
        [Key(10)] public int CardNum;

        /// <summary>
        /// 解散原因
        /// </summary>
        [Key(11)] public int DisBankStyle;

        /// <summary>
        /// 分值
        /// </summary>
        [Key(12)] public List<PlayerFightData> Players;
        
        /// <summary>
        /// 解散
        /// </summary>
        [Key(13)] public int DisUserId;
    }


    /// <summary>
    /// 玩家
    /// </summary>
    [MessagePackObject]
    public class PlayerFightData
    {
        /// <summary>
        /// 用户唯一id
        /// </summary>
        [Key(0)] public int UserId;

        /// <summary>
        /// 昵称
        /// </summary>
        [Key(1)] public string NickName;

        /// <summary>
        /// 分值
        /// </summary>
        [Key(2)] public double Score;

        /// <summary>
        /// 玩家头像
        /// </summary>
        [Key(3)] public string Photo;

        /// <summary>
        /// 俱乐部id
        /// </summary>
        [Key(4)] public int ClubId;

        /// <summary>
        /// 俱乐部名字
        /// </summary>
        [Key(5)] public string ClubName;
    }
}