using System.Collections.Generic;
using GameMessage.Const;
using MessagePack;

namespace GameMessage
{
    [Message(MessageCode.PayPrepareRequest)]
    [MessagePackObject]
    public class PayPrepareRequest : MessageData
    {
        /// <summary>
        /// 支付渠道
        /// </summary>
        [Key(0)]public PaymentChannel PaymentChannel;

        /// <summary>
        /// 订单渠道来源
        /// </summary>
        [Key(1)]public ChannelOriginType ChannelOriginType;

        /// <summary>
        /// 付款商品Id 对应 ProductionConfig
        /// </summary>
        [Key(2)]public int ProductId;

        /// <summary>
        /// 购买数量
        /// </summary>
        [Key(3)]public int Quantity;

        /// <summary>
        /// 购买的商品Id（主要处理钻石不足情况下：先充值钻石然后再获得该商品）
        /// </summary>
        [Key(4)] public int BuyProductId;

        /// <summary>
        /// 充值对象角色类型
        /// </summary>
        [Key(5)]public OrderRoleType ReceiveOrderRoleType;
        
        /// <summary>
        /// 接受商品角色Id
        /// </summary>
        [Key(6)]public int ReceiveRoleId;

        /// <summary>
        /// 不同支付的透传参数 ： Json
        /// </summary>
        [Key(7)]public string Body;
        
#if GameClient
        public static PayPrepareRequest Create()
        {
            return GameFramework.ReferencePool.Acquire<PayPrepareRequest>();
        }
#endif
    }

    [Message(MessageCode.PayPrepareResponse)]
    [MessagePackObject]
    public class PayPrepareResponse : MessageData
    {
        [Key(0)]public int ErrorCode;
        [Key(1)]public PaymentChannel PaymentChannel;
        /// <summary>
        /// 订单
        /// </summary>
        [Key(2)]public string TradeNo;
        [Key(3)]public string Body;
        [Key(4)]public string TotalAmount;
        /// <summary>
        /// 可以获得所有资产
        /// </summary>
        [Key(5)]public List<PlayerPropertyPack> PropertyPacks;
    }

    [Message(MessageCode.PayC2SNotifyRequest)]
    [MessagePackObject]
    public class PayC2SNotifyRequest : MessageData
    {
        [Key(0)]public PaymentChannel PaymentChannel;
        [Key(1)]public string Body;
        
#if GameClient
        public static PayC2SNotifyRequest Create()
        {
            return GameFramework.ReferencePool.Acquire<PayC2SNotifyRequest>();
        }
#endif
    }
    
    [Message(MessageCode.PayC2SNotifyResponse)]
    [MessagePackObject]
    public class PayC2SNotifyResponse : MessageData
    {
        [Key(0)]public PaymentChannel PaymentChannel;
        [Key(1)]public string Body;
        [Key(2)]public bool IsSuccess;
    }
}