using System;
using Aliyun.Api.LogService.Domain.Log;
using Server.Core;

namespace Server.AliyunSDK.SLSLog
{
    /// <summary>
    /// 道具日志
    /// </summary>
    public class UserPropLogData : SLSLogData
    {
        /// <summary>
        /// 玩家ID
        /// </summary>
        public int UserId;
        
        /// <summary>
        /// 道具ID
        /// </summary>
        public int PropId;

        /// <summary>
        /// 变化值
        /// </summary>
        public long ChangeNum;

        /// <summary>
        /// 最终值
        /// </summary>
        public long FinalValue;

        /// <summary>
        /// 服务器节点ID
        /// </summary>
        public int ServerNodeId;

        /// <summary>
        /// 服务器节点编号
        /// </summary>
        public int ServerNodeNum;
        
        /// <summary>
        /// 标签
        /// </summary>
        public string Tag;

        public static UserPropLogData Create(int userId,int propId,long changeNum,long finalValue,int serverNodeId,int serverNodeNum,string tag)
        {
            UserPropLogData data = ReferencePool.Fetch<UserPropLogData>();
            data.UserId = userId;
            data.PropId = propId;
            data.ChangeNum = changeNum;
            data.FinalValue = finalValue;
            data.ServerNodeId = serverNodeId;
            data.ServerNodeNum = serverNodeNum;
            data.Tag = tag;
            data.Time = DateTimeOffset.Now;
            return data;
        }
    }
}