using System;
using ProtoBuf;
using Fantasy;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
using System.Collections.Concurrent;
using Fantasy.Serialize;
using Fantasy.ConfigTable;

namespace NBF
{
    [ProtoContract]
    public sealed partial class FeederConfig : ASerialize, IProto, IConfigTable
    {
    
		[ProtoMember(1)]
		public uint Id { get; set; } // Id
		[ProtoMember(2)]
		public string Model { get; set; } // 模型
		[ProtoMember(3)]
		public uint Type { get; set; } // 类型
		[ProtoMember(4)]
		public uint Capacity { get; set; } // 能力
		[ProtoMember(5)]
		public uint Weight { get; set; } // 重量(克)  
        [ProtoIgnore]
        public uint Key => Id;
        
        #region Static
        
        private static ConfigContext<FeederConfig> Context => ConfigTableHelper.Table<FeederConfig>();

        public static FeederConfig Get(uint key)
        {
            return Context.Get(key);
        }

        public static FeederConfig Get(Predicate<FeederConfig> match)
        {
            return Context.Get(match);
        }
        
        public static FeederConfig Fist()
        {
            return Context.Fist();
        }

        public static FeederConfig Last()
        {
            return Context.Last();
        }

        public static FeederConfig Fist(Predicate<FeederConfig> match)
        {
            return Context.Fist(match);
        }

        public static FeederConfig Last(Predicate<FeederConfig> match)
        {
            return Context.Last(match);
        }
        
        public static int Count()
        {
            return Context.Count();
        }

        public static int Count(Func<FeederConfig, bool> predicate)
        {
            return Context.Count(predicate);
        }

        public static List<FeederConfig> GetList()
        {
            return Context.GetList();
        }

        public static List<FeederConfig> GetList(Predicate<FeederConfig> match)
        {
            return Context.GetList(match);
        }
        public static void ParseJson(Newtonsoft.Json.Linq.JArray arr)
        {
            ConfigTableHelper.ParseLine<FeederConfig>(arr);
        }
        #endregion
    }
}