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 (ConfigName) : ASerialize, IProto, IConfigTable
    {
    (Fields)  
        [ProtoIgnore]
        public uint Key => Id;
        
        #region Static
        
        private static ConfigContext<(ConfigName)> Context => ConfigTableHelper.Table<(ConfigName)>();

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

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

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

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

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

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

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

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