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 BaitConfig : ASerialize, IProto, IConfigTable
    {
    
		[ProtoMember(1)]
		public uint Id { get; set; } // Id
		[ProtoMember(2)]
		public string Model { get; set; } // 模型
		[ProtoMember(3)]
		public uint EfficacyBase { get; set; } // 吸引力
		[ProtoMember(4)]
		public uint Length { get; set; } // 长度（毫米）
		[ProtoMember(5)]
		public uint Weight { get; set; } // 重量(克)
		[ProtoMember(6)]
		public uint[] Arr { get; set; } = Array.Empty<uint>(); // 重量(克)
		[ProtoMember(7)]
		public string[] ArrStr { get; set; } = Array.Empty<string>(); // 重量(克)  
        [ProtoIgnore]
        public uint Key => Id;
        
        #region Static
        
        private static ConfigContext<BaitConfig> Context => ConfigTableHelper.Table<BaitConfig>();

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

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

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

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

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

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

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

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