using MessagePack;

#if GameClient
using GameFramework;
#endif

namespace GameMessage
{
    /// <summary>
    /// 资产明细请求
    /// </summary>
    [Message(MessageCode.AssetDetailRequest)]
    [MessagePackObject()]
    public class AssetDetailRequest : MessageData
    {
        /// <summary>
        /// 资产Id
        /// </summary>
        [Key(0)]
        public int AssetId;

#if GameClient
        public static AssetDetailRequest Create(int assetId)
        {
            AssetDetailRequest request = ReferencePool.Acquire<AssetDetailRequest>();
            request.AssetId = assetId;
            return request;
        }
#endif
    }
    
    /// <summary>
    /// 资产明细响应
    /// </summary>
    [Message(MessageCode.AssetDetailResponse)]
    [MessagePackObject()]
    public class AssetDetailResponse : MessageData
    {
        [Key(0)]
        public int AssetId;

        [Key(1)]
        public AssetDetailValue[] Values;
    }

    [MessagePackObject()]
    public class AssetDetailValue
    {
        /// <summary>
        /// 资源Id
        /// </summary>
        [Key(0)]
        public int ResId;

        /// <summary>
        /// 资源类型
        /// </summary>
        [Key(1)]
        public int ResType;

        /// <summary>
        /// 变化时间
        /// </summary>
        [Key(2)]
        public long ChangeTime;

        /// <summary>
        /// 变化值
        /// </summary>
        [Key(3)]
        public long ChangeValue;

        /// <summary>
        /// 余额
        /// </summary>
        [Key(4)]
        public long NowValue;
    }
}
