package com.ruoyi.info.collection.enums;

/**
 * 实体风险等级枚举
 *
 * @author ruoyi
 */
public enum EnterpriseRiskLevel {

    HIGH("1", "高风险"),
    MEDIUM("2", "中风险"),
    LOW("3", "低风险");

    private final String code;
    private final String desc;

    EnterpriseRiskLevel(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static String getDescByCode(String code) {
        for (EnterpriseRiskLevel value : values()) {
            if (value.code.equals(code)) {
                return value.desc;
            }
        }
        return null;
    }

    public static boolean contains(String code) {
        for (EnterpriseRiskLevel value : values()) {
            if (value.code.equals(code)) {
                return true;
            }
        }
        return false;
    }

    public static String resolveCode(String value) {
        for (EnterpriseRiskLevel item : values()) {
            if (item.code.equals(value) || item.desc.equals(value)) {
                return item.code;
            }
        }
        return null;
    }
}
