package cn.cecep.talroad.enums;

import java.util.Arrays;

public enum GtDeviceTypeEnum {
    SJJ("SJJ","烧结机"),
    SL("SL","竖炉"),
    GL("GL","高炉"),
    ZL("ZL","转炉"),
    LY("LY","炉窑"),
    GLMQ("GLMQ","高炉煤气"),
    GLMQG("GLMQG","高炉煤气柜"),
    ZLMQ("ZLMQ","转炉煤气"),
    PLPD("PLPD","配料皮带"),
    FDJZ("FDJZ","发电机组"),
    ZBDC("ZBDC","自备电厂"),
    VOC("VOC","VOC治理"),
    BJCC("BJCC","苯和焦油储槽"),
    CB("CB","粗苯"),
    GXJ("GXJ","干熄焦"),
    JLMQ("JLMQ","焦炉煤气"),
    MQGW("MQGW","煤气管网"),
    JL("JL","焦炉");


    private String code;
    private String name;

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


    /**
     * 根据编码获取名称
     * @param code
     * @return
     */
    public String getNameByCode(String code){
        return Arrays.stream(values()).filter(v -> v.getCode().equalsIgnoreCase(code)).findAny().get().getName();
    }

    /**
     * 根据编码获取枚举类型
     * @param code
     * @return
     */
    public GtDeviceTypeEnum getEnumByCode(String code){
        return Arrays.stream(values()).filter(v -> v.getCode().equalsIgnoreCase(code)).findAny().get();
    }

    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;
    }
}
