package cn.cecep.talroad.enums;

import java.util.Arrays;

/**
 * @Auther: cjh
 * @Date: 2023-06-10 15:21
 * @Class: StopTypeEnum
 * @Deseription:
 * @Version V1.0
 */
public enum StopTypeEnum {

    ST1("stop_dcs_type1", "FA"),//停运
    ST2("stop_dcs_type2", "ST"),//启炉
    ST3("stop_dcs_type3", "B"),//焖炉
    ST4("stop_dcs_type4", "SD"),//停炉
    ST5("stop_dcs_type5", "SCGZ");//生产故障

    private String code;
    private String name;

    StopTypeEnum(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){
        StopTypeEnum typeEnum = Arrays.stream(values()).filter(v -> v.getCode().equalsIgnoreCase(code)).findFirst().orElse(null);
        if (typeEnum==null){
            return "";
        }
        return typeEnum.getName();
    }

}
