using System.Linq;

namespace JiaZhiQuan.Common.ClassEnum {
    public sealed class AppIndexTabEnum : AbstractEnum<AppIndexTabEnum> {
        public static AppIndexTabEnum COMMUNITY => new AppIndexTabEnum(0, "AppIndexPageTabConfig","社区");
        public static AppIndexTabEnum MALL => new AppIndexTabEnum(1, "MallAppIndexPageTabConfig","商城");

        public readonly string configKeyName;
        public readonly int category;
        public readonly string desc;

        private AppIndexTabEnum(int category, string configKeyName,string desc) {
            this.category = category;
            this.configKeyName = configKeyName;
            this.desc = desc;
        }

        public static AppIndexTabEnum GetEnumByName(string configKeyName) {
            return Values.FirstOrDefault(item => item.configKeyName == configKeyName);
        }
        public static AppIndexTabEnum GetEnumByCategory(int? category) {
            return Values.FirstOrDefault(item => item.category == category);
        }
    }
}
