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

namespace GameMessage
{
    /// <summary>
    /// 俱乐部房卡转入请求消息
    /// </summary>
    [Message(MessageCode.ClubCardTransferInRequest)]
    [MessagePackObject]
    public class ClubCardTransferInRequest : MessageData
    {
        /// <summary>
        /// 俱乐部ID
        /// </summary>
        [Key(0)]
        public int ClubId;

        /// <summary>
        /// 房卡数量
        /// </summary>
        [Key(1)]
        public int CardCnt;

#if GameClient
        public static ClubCardTransferInRequest Create(int clubId,int cardCnt)
        {
            ClubCardTransferInRequest request = ReferencePool.Acquire<ClubCardTransferInRequest>();
            request.ClubId = clubId;
            request.CardCnt = cardCnt;
            return request;
        }
#endif
    }
    
    /// <summary>
    /// 俱乐部房卡转入响应消息
    /// </summary>
    [Message(MessageCode.ClubCardTransferInResponse)]
    [MessagePackObject]
    public class ClubCardTransferInResponse : MessageData
    {
        /// <summary>
        /// 结果代码
        /// </summary>
        [Key(0)]
        public int ResultCode;

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

        /// <summary>
        /// 房卡数量
        /// </summary>
        [Key(2)]
        public int CardCnt;
    }

    /// <summary>
    /// 俱乐部房卡转换记录请求消息
    /// </summary>
    [Message(MessageCode.ClubCardTransferRecordRequest)]
    [MessagePackObject]
    public class ClubCardTransferRecordRequest : MessageData
    {
        /// <summary>
        /// 俱乐部ID
        /// </summary>
        [Key(0)]
        public int ClubId;

        /// <summary>
        /// 分页数据
        /// </summary>
        [Key(1)]
        public DataPage Page;

#if GameClient
        public static ClubCardTransferRecordRequest Create(int clubId)
        {
            ClubCardTransferRecordRequest request = ReferencePool.Acquire<ClubCardTransferRecordRequest>();
            request.ClubId = clubId;
            return request;
        }
#endif
    }

    /// <summary>
    /// 俱乐部房卡转换记录响应消息
    /// </summary>
    [Message(MessageCode.ClubCardTransferRecordResponse)]
    [MessagePackObject]
    public class ClubCardTransferRecordResponse : MessageData
    {
        /// <summary>
        /// 结果代码
        /// </summary>
        [Key(0)]
        public int ResultCode;

        /// <summary>
        /// 俱乐部ID
        /// </summary>
        [Key(1)]
        public int ClubId;
        
        /// <summary>
        /// 房卡支付信息列表
        /// </summary>
        [Key(2)]
        public List<ClubCardPayInfo> PayInfos;

        /// <summary>
        /// 总数
        /// </summary>
        [Key(3)]
        public int Count;
    }

    /// <summary>
    /// 俱乐部房卡支付信息
    /// </summary>
    [MessagePackObject]
    public class ClubCardPayInfo
    {
        /// <summary>
        /// 记录ID
        /// </summary>
        [Key(0)]
        public int Id;

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

        /// <summary>
        /// 用户ID
        /// </summary>
        [Key(2)]
        public int UserId;

        /// <summary>
        /// 房卡数量
        /// </summary>
        [Key(3)]
        public int CardCount;

        /// <summary>
        /// 用户昵称
        /// </summary>
        [Key(4)]
        public string NickName;

        /// <summary>
        /// 时间戳
        /// </summary>
        [Key(5)]
        public long DateTime;

        /// <summary>
        /// 性别
        /// </summary>
        [Key(6)]
        public int Sex;
        
        [Key(7)]
        public ClubPayCardOrigin Origin;
    }
    
    /// <summary>
    /// 房卡转入类型
    /// </summary>
    public enum ClubPayCardOrigin
    {
        Normal = 0, // 普通转入
        Pay = 1,  // 充值
        Give = 2, // 赠送
    }
}