package com.xhpc.common.enums;

public enum StationDeviceEnum {

    STATION("STATION", "充电站"),
    PILE("PILE", "充电桩"),
    TERMINAL("TERMINAL", "充电终端"),
    BARRIER("BARRIER", "道闸"),
    GROUND_LOCK("GROUND_LOCK", "地锁")
    ;


    private final String code;
    private final String name;

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

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

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

    public String getCode() {

        return code;
    }

    public String getName() {

        return name;
    }
}
