using MessagePack;

#if Server
using MrWu.Debug;
using Server.Core;
#endif

namespace GameMessage
{
    [Message(MessageCode.SubsidyCntRequest)]
    [MessagePackObject]
    public class SubsidyCntRequest : MessageData
    {
    }

    [Message(MessageCode.SubsidyCntResponse)]
    [MessagePackObject]
    public class SubsidyCntResponse : MessageData
    {
        /// <summary>
        /// 救济金版本
        /// </summary>
        [Key(0)]
        public int Version;
        
        /// <summary>
        /// 救助金领取次数
        /// </summary>
        [Key(1)] public int SubsidyCnt;

        /// <summary>
        /// 表示时间
        /// </summary>
        [Key(2)] public int DayOfYear;

#if Server
        public static SubsidyCntResponse Create()
        {
            Debug.Info("SubsidyCntResponse Create");
            SubsidyCntResponse self = ReferencePool.Fetch<SubsidyCntResponse>();
            self.SubsidyCnt = 0;
            self.DayOfYear = 0;
            return self;
        }

        public override void Dispose()
        {
            Debug.Info("SubsidyCntResponse Dispose");
            ReferencePool.Recycle(this);
        }
#endif
    }

    [Message(MessageCode.SubsidyReceiveRequest)]
    [MessagePackObject]
    public class SubsidyReceiveRequest : MessageData
    {
        /// <summary>
        /// 领取金额
        /// </summary>
        [Key(0)] public int ReceiveMoney;

        /// <summary>
        /// 是否看广告
        /// </summary>
        [Key(1)] public bool IsAd;
    }

    [Message(MessageCode.SubsidyReceiveResponse)]
    [MessagePackObject]
    public class SubsidyReceiveResponse : MessageData
    {
        /// <summary>
        /// 领取得到的金额
        /// </summary>
        [Key(0)] public int ReceiveMoney;

        /// <summary>
        /// 已经领取的次数
        /// </summary>
        [Key(1)] public int SubsidyCnt;

        /// <summary>
        /// 当年的天数
        /// </summary>
        [Key(2)] public int DayOfYear;

        /// <summary>
        /// 领取结果
        /// </summary>
        [Key(3)] public int ResultCode;

#if Server
        public static SubsidyReceiveResponse Create()
        {
            SubsidyReceiveResponse self = ReferencePool.Fetch<SubsidyReceiveResponse>();
            self.ReceiveMoney = 0;
            self.SubsidyCnt = 0;
            self.DayOfYear = 0;
            self.ResultCode = 0;
            return self;
        }

        public override void Dispose()
        {
            ReferencePool.Recycle(this);
        }
#endif
    }
}