package com.crunii.micro.common.enums;

/**
 * @author lmlksy
 * @date 2023/11/22 15:26
 */
public enum PolicyLevelEnums {

    NATIONAL(0, "国家级"),
    MUNICIPAL(1, "市级");

    private final Integer code;
    private final String description;

    PolicyLevelEnums(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    public Integer getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static Integer getCodeByDescription(String description) {
        for (PolicyLevelEnums level : values()) {
            if (level.getDescription().equals(description)) {
                return level.getCode();
            }
        }
        return null;
    }

    public static String getDescriptionByCode(Integer code) {
        for (PolicyLevelEnums level : values()) {
            if (level.getCode().equals(code)) {
                return level.getDescription();
            }
        }
        return null;
    }
}
