package com.xhpc.common.enums;


/**
 * 充电设备类型
 */
public enum ConnectorTypeEnum {

    HOME_OUTLET(1, "家用插座"),
    AC_OUTLET(2, "交流接口插座"),
    AC_PLUG(3, "交流接口插头"),
    DC_PLUG(4, "直流接口枪头"),
    WIRELESS_OUTLET(5, "无线充电座"),
    OTHER(6, "其他"),
    ;

    private final int code;
    private final String name;

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

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

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

    public int getCode() {

        return code;
    }

    public String getName() {

        return name;
    }

}
