package com.sundot.airport.common.enums.portrait;

/**
 * 指标类型枚举
 */
public enum IndicatorType {

    /**
     * 资质等级
     */
    QUALIFICATION_LEVEL(1, "qualificationLevel", "资质等级", "system"),

    /**
     * 可上岗岗位
     */
    AVAILABLE_POSITIONS(2, "availablePositions", "可上岗岗位", "system"),

    /**
     * 政治面貌
     */
    POLITICAL_STATUS(3, "politicalStatus", "政治面貌", "system"),

    /**
     * 年龄
     */
    AGE(4, "age", "年龄", "system"),

    /**
     * 身体健康状况
     */
    PHYSICAL_HEALTH_STATUS(5, "physicalHealthStatus", "身体健康状况", "system"),

    /**
     * 政审通过情况
     */
    POLITICAL_REVIEW_STATUS(6, "politicalReviewStatus", "政审通过情况", "system"),

    /**
     * 行政类处罚情况
     */
    ADMINISTRATIVE_PENALTY(7, "administrativePenalty", "行政类处罚情况", "system"),

    /**
     * 学历情况
     */
    EDUCATION(8, "education", "学历情况", "system"),

    /**
     * 工作奖励
     */
    WORK_REWARDS(9, "workRewards", "工作奖励", "system"),

    /**
     * 工作处罚
     */
    WORK_PENALTIES(10, "workPenalties", "工作处罚", "system"),

    /**
     * 工作年限
     */
    WORK_YEARS(11, "workYears", "工作年限", "system"),

    /**
     * 安检工作年限
     */
    SECURITY_WORK_YEARS(12, "securityWorkYears", "安检工作年限", "system"),

    /**
     * 安检工作职务
     */
    SECURITY_WORK_POSITION(13, "securityWorkPosition", "安检工作职务", "system"),

    /**
     * 出勤天数
     */
    WORKING_DATE(14, "workingDate", "出勤天数", "attendance"),

    /**
     * 上岗时长
     */
    WORKING_HOURS(15, "workingHours", "上岗时长", "attendance"),

    /**
     * 有效查获数量
     */
    EFFECTIVE_SEIZURE_COUNT(16, "effectiveSeizureCount", "有效查获数量", "item"),

    /**
     * 故意隐匿查获数量
     */
    WILLFUL_CONCEALMENT_COUNT(17, "willfulConcealmentCount", "故意隐匿查获数量", "item"),

    /**
     * 移交公安查获数量
     */
    REFER_TO_POLICE_COUNT(18, "referToPoliceCount", "移交公安查获数量", "item");

    private final int id;
    private final String code;
    private final String description;
    private final String module;

    IndicatorType(int id, String code, String description, String module) {
        this.id = id;
        this.code = code;
        this.description = description;
        this.module = module;
    }

    public int getId() {
        return id;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public String getModule() {
        return module;
    }

    /**
     * 根据代码获取枚举值
     *
     * @param code 代码
     * @return 对应的枚举值，找不到返回null
     */
    public static IndicatorType fromCode(String code) {
        for (IndicatorType type : IndicatorType.values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }

    /**
     * 根据ID获取枚举值
     *
     * @param id ID
     * @return 对应的枚举值，找不到返回null
     */
    public static IndicatorType fromId(int id) {
        for (IndicatorType type : IndicatorType.values()) {
            if (type.getId() == id) {
                return type;
            }
        }
        return null;
    }

    /**
     * 获取指定模块的指标类型列表
     *
     * @param module 模块名称
     * @return 指标类型列表
     */
    public static IndicatorType getTypesByModule(String module) {
        for (IndicatorType type : IndicatorType.values()) {
            if (type.getModule().equals(module)) {
                return type;
            }
        }
        return null;
    }
}