package cn.cecep.talroad.enums;

import java.util.Arrays;

/**
 * @Auther: cjh
 * @Date: 2023-06-11 13:57
 * @Class: WhiteListTypeEnum
 * @Deseription:
 * @Version V1.0
 */
public enum WhiteListTypeEnum {

    ST0("ps_whitelist_reason0", "C"),
    ST1("ps_whitelist_reason1", "C"),
    ST2("ps_whitelist_reason2", "C"),
    ST3("ps_whitelist_reason3", "D"),
    ST4("ps_whitelist_reason4", "C"),
    ST5("ps_whitelist_reason5", "C"),
    ST6("ps_whitelist_reason6", "C"),
    ST7("ps_whitelist_reason7", "C"),
    ST8("ps_whitelist_reason8", "C"),
    ST9("ps_whitelist_reason9", "D"),
    ST10("ps_whitelist_reason10", "G"),
    ST11("ST","ST"),//启炉
    ST12("STA","ST"),//启炉
    ST13("SD","SD"),//停炉
    ST14("FA","SD"),//停炉
    ST15("B","B"),//焖炉
    ST16("F","FA");//停运

    private String code;
    private String name;

    WhiteListTypeEnum(String code, String name){
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    /**
     * 根据编码获取名称
     * @param code
     * @return
     */
    public static String getNameByCode(String code){
        WhiteListTypeEnum typeEnum = Arrays.stream(values()).filter(v -> v.getCode().equalsIgnoreCase(code)).findFirst().orElse(null);
        if (typeEnum==null){
            return "";
        }
        return typeEnum.getName();
    }
}
