using MessagePack;

#if GameClient
using GameFramework;
#endif

namespace GameMessage
{
    [Message(MessageCode.HuaWeiPayRequest)]
    [MessagePackObject]
    public class HuaWeiPayRequest : MessageData
    {
        /// <summary>
        /// 给服务器使用的商品ID
        /// </summary>
        [Key(0)] public string ProductId;

        /// <summary>
        /// 给服务使用的商品token
        /// </summary>
        [Key(1)] public string PurchaseToken;

        /// <summary>
        /// 购买详情
        /// </summary>
        [Key(2)] public string InAppPurchaseData;

        /// <summary>
        /// 签名字符串
        /// </summary>
        [Key(3)] public string InAppPurchaseDataSignature;

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

        public override void Clear()
        {
            ProductId = null;
            PurchaseToken = null;
            InAppPurchaseData = null;
            InAppPurchaseDataSignature = null;
        }
#endif
    }

    [Message(MessageCode.HuaWeiPayResponse)]
    [MessagePackObject]
    public class HuaWeiPayReponse : MessageData
    {
        /// <summary>
        /// 给服务器使用的商品ID
        /// </summary>
        [Key(0)] public string ProductId;

        /// <summary>
        /// 给服务使用的商品token
        /// </summary>
        [Key(1)] public string PurchaseToken;

        /// <summary>
        /// 购买详情
        /// </summary>
        [Key(2)] public string InAppPurchaseData;

        /// <summary>
        /// 签名字符串
        /// </summary>
        [Key(3)] public string InAppPurchaseDataSignature;

        /// <summary>
        /// 状态 1成功 其他失败
        /// </summary>
        [Key(4)] public int State;

        /// <summary>
        /// 加的道具类型
        /// 1钻石 2礼券 3参赛卷 4门票 5复活卡 6金币 7红包券
        /// </summary>
        [Key(5)] public int Type;

        /// <summary>
        /// 需要加的数值
        /// </summary>
        [Key(6)] public int Value;
    }
}