package com.xhpc.common.enums;


/**
 * 设备类型
 */
public enum PileEquipmentTypeEnum {

    DC(1, "直流设备"),
    AC(2, "交流设备"),
    DC_AC(3, "交直流一体设备"),
    WIRELESS(4, "无线设备"),
    OTHER(5, "其他"),
    ;

    private final int code;
    private final String name;

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

    //根据code获取name
    public static String getNameByCode(int code) {
        for (PileEquipmentTypeEnum typeEnum : PileEquipmentTypeEnum.values()) {
            //移除交办
            if (typeEnum.code == code) {
                return typeEnum.name;
            }
        }
        return "";
    }

    //根据code获取name
    public static Integer getCodeByName(String name) {
        for (PileEquipmentTypeEnum typeEnum : PileEquipmentTypeEnum.values()) {
            //移除交办
            if (typeEnum.name.equals(name)) {
                return typeEnum.code;
            }
        }
        return null;
    }

    public int getCode() {

        return code;
    }

    public String getName() {

        return name;
    }
}
