package com.jsowell.common.enums.ykc;

/**
 * 充电桩故障原因enum
 *
 * @author JS-ZZA
 * @date 2022/10/17 9:03
 */
public enum YKCPileFaultReasonEnum {

    STOP_BUTTON_FAULT(1, "急停按钮动作故障"),
    NO_CAN_USE_RECTIFICATION_MODEL_FAULT(2, "无可用整流模块"),
    OUTLET_TEMPERATURE_TOO_HIGH_FAULT(3, "出风口温度过高"),
    ALTERNATING_LIGHTING_PROTECTION_FAULT(4, "交流防雷故障"),
    DC20_COMMUNICATION_INTERRUPT_FAULT(5, "交直流模块 DC20 通信中断"),
    FC08_COMMUNICATION_INTERRUPT_FAULT(6, "交直流模块 FC08 通信中断"),
    WATT_HOUR_METER_COMMUNICATION_INTERRUPT_FAULT(7, "电度表通信中断"),
    CARD_READER_COMMUNICATION_INTERRUPT_FAULT(8, "读卡器通信中断"),
    RC10_COMMUNICATION_INTERRUPT_FAULT(9, "RC10 通信中断"),
    FAN_SPEED_CONTROL_FAULT(10, "风扇调速板故障"),
    DC_FUSE_FAULT(11, "直流熔断器故障"),
    HIGH_PRESSURE_CONTACTOR_FAULT(12, "高压接触器故障"),
    DOOR_OPEN_FAULT(13, "门打开"),
    ;

    /**
     * 根据code获取故障描述
     *
     * @param code 故障编码
     * @return 故障描述
     */
    public static String getValueByCode(int code) {
        for (YKCPileFaultReasonEnum item : YKCPileFaultReasonEnum.values()) {
            if (item.getCode() == code) {
                return item.getValue();
            }
        }
        return null;
    }

    private int code;
    private String value;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    YKCPileFaultReasonEnum(int code, String value) {
        this.code = code;
        this.value = value;
    }
}
