// Generate By EToy
// Don't Edit It!!

using XGame.Framework.Database;
using XGame.Framework.Serialization;

namespace XGame.Database
{
    /// <summary> Item </summary>
    public sealed class ItemTable : ITable
    {
        long ITable.Key => Id;

        public int Id { get; private set; }

        /// <summary> 0：资源类1：代币类2：抽奖道具3：其他道具4：礼包类5：头衔6：外观7：特权卡8：红包9：符石10：装备11：飞剑12：技能 </summary>
        public int Type { get; private set; }

        /// <summary> 0：无1：获取时自动开启2：手动开启 </summary>
        public int Subtype { get; private set; }

        public string Name { get; private set; }

        public string Desc { get; private set; }

        public string Icon { get; private set; }

        public EQualityLevel Quality { get; private set; }

        /// <summary> [1：加速时间] </summary>
        public int[] Effect { get; private set; }

        /// <summary> 回收价格 </summary>
        public int RecyclingPrices { get; private set; }

        /// <summary> 时效 </summary>
        public int Duration { get; private set; }

        void ISerializable.Deserialize(IReader reader)
        {
            Id = reader.ReadInt();
            Type = reader.ReadInt();
            Subtype = reader.ReadInt();
            Name = reader.ReadString();
            Desc = reader.ReadString();
            Icon = reader.ReadString();
            Quality = (EQualityLevel)reader.ReadInt();
            Effect = reader.ReadEnumerable<int[]>();
            RecyclingPrices = reader.ReadInt();
            Duration = reader.ReadInt();
        }

        void ISerializable.Serialize(IWriter writer)
        {
            writer.Write(Id);
            writer.Write(Type);
            writer.Write(Subtype);
            writer.Write(Name);
            writer.Write(Desc);
            writer.Write(Icon);
            writer.Write((int)Quality);
            writer.Write(Effect);
            writer.Write(RecyclingPrices);
            writer.Write(Duration);
        }
    }
}
