package com.huatek.busi.common;

import com.google.common.base.Objects;

public enum CacDataType {
    BYQ("1", "变压器"),

    CAP("2", "容性设备"),

    BLQ("3", "避雷器"),

    GIS("4", "GIS设备"),

    CW("6", "测温"),

    QT("7", "其它"),

    DL("8", "电缆"),

    GEN("9", "发电机");
    private final String code;
    private final String name;

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

    public boolean isThis(String code) {
        return this.code.equals(code);
    }

    public static CacDataType from(String code) {
        for (CacDataType cacDataType : CacDataType.values()) {
            if (Objects.equal(code, cacDataType.getCode())) {
                return cacDataType;
            }
        }
        throw new RuntimeException("cac data type undefined:" + code);
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }
}
