package com.jsowell.common.enums.thirdparty.huawei;


/**
 * 华为开始启动失败原因对应枚举
 *
 * @author Lemon
 * @Date 2024/1/26 15:00:56
 */
public enum StartFailedReasonEnum {


    /**
     * 桩侧异常停止
     */
    DISCONNECT_WITH_PLATFORM_STOP(23000, "与平台断链停止"),

    /**
     * 用户操作停止
     */
    THE_OWNER_ACTIVELY_UNLOCKS_AND_STOPS(23002, "车主主动解锁停止"),

    /**
     * 枪侧异常停止
     */
    UNKNOWN_SYSTEM_TYPE(23001, "未知系统类型"),
    STOP_CHARGING_BECAUSE_THE_TEMPERATURE_CONTROL_IS_ABNORMAL(23003, "温控异常需要停止充电"),
    GUN_TEMPERATURE_ANOMALY(23004, "枪温度异常"),
    HOST_SYSTEM_EXCEPTION(23005, "主机系统异常"),
    GUN_HEAD_MOUNTED_ABNORMALLY(23006, "枪头安装异常"),

    /**
     * 充电管理启动充电异常
     */
    THE_ACCOUNTING_MODEL_DOES_NOT_EXIST(23007, "计费模型不存在"),
    THE_DEVICE_IS_NOT_CONNECTED_TO_THE_VEHICLE(23066, "设备未连接车辆"),
    EQUIPMENT_UPGRADING(23067, "设备升级中"),
    EQUIPMENT_OUTAGE(23068, "设备停运"),
    EQUIPMENT_RETURN(23069, "设备退运"),
    EQUIPMENT_FREEZING(23070, "设备冻结"),
    OTHER_REASONS_FOR_FAILURE(23072, "其他失败原因"),

    /**
     * 主机侧异常停止
     */
    MAIN_ENGINE_EMERGENCY_STOP(23008, "主机急停"),
    MAIN_ENGINE_SIDE_DOOR_OPENING(23009, "主机侧开门"),
    MAIN_ENGINE_FLOODING(23010, "主机水浸"),
    PHASE_SEQUENCE_ANOMALY(23011, "相序异常"),
    AC_SURGE_PROTECTION_1_IS_FAULTY(23012, "交流防雷1故障"),
    AC_SURGE_PROTECTION_2_IS_FAULTY(23013, "交流防雷2故障"),
    AC_SURGE_PROTECTION_3_IS_FAULTY(23014, "交流防雷3故障"),
    AC_OUTAGE(23015, "交流停电"),
    AC_OVERVOLTAGE(23016, "交流过压"),
    AC_UNDERVOLTAGE(23017, "交流欠压"),
    AC_L1_MISSING_PHASE(23018, "交流L1缺相"),
    AC_L2_MISSING_PHASE(23019, "交流L2缺相"),
    AC_L3_MISSING_PHASE(23020, "交流L3缺相"),
    THE_AC_BRANCH_CURRENT_IS_ABNORMAL_PROCEDURE(23065, "交流支路电流异常"),
    ALL_COMMUNICATION_BETWEEN_THE_DCDC_GROUP_FAILS(23021, "DCDC组所有通信失败"),
    THE_DCDC_MODULE_IS_FAULTY(23022, "DCDC模块故障"),
    THE_SYSTEM_TYPE_ON_THE_HOST_IS_UNKNOWN(23023, "主机上未知系统类型"),
    PUMP_1_IDLING(23024, "水泵1空转"),
    PUMP_2_IDLING(23025, "水泵2空转"),
    PUMP_3_IDLING(23026, "水泵3空转"),
    WATER_PUMP_1_OVERFLOWS(23027, "水泵1过流"),
    WATER_PUMP_2_OVERFLOWS(23028, "水泵2过流"),
    WATER_PUMP_3_OVERFLOWS(23029, "水泵3过流"),
    PUMP_1_OVERHEATS(23030, "水泵1过温"),
    PUMP_2_OVERHEATS(23031, "水泵2过温"),
    PUMP_3_OVERHEATS(23032, "水泵3过温"),
    WATER_PUMP_1_FAULTY(23033, "水泵1故障"),
    WATER_PUMP_2_FAULTY(23034, "水泵2故障"),
    WATER_PUMP_3_FAULTY(23035, "水泵3故障"),
    PUMP_1_HAS_NO_FEEDBACK(23036, "水泵1无反馈"),
    PUMP_2_HAS_NO_FEEDBACK(23037, "水泵2无反馈"),
    PUMP_3_HAS_NO_FEEDBACK(23038, "水泵3无反馈"),
    THE_TEMPERATURE_CONTROL_DETECTION_UNIT_IS_ABNORMAL(23039, "温控检测单元异常"),
    THE_SELF_DESCRIPTION_FILE_IS_ABNORMAL(23040, "自描述文件异常"),
    THE_MATRIX_CONTACTOR_IS_FAULTY(23041, "矩阵接触器故障"),
    THE_CHARGING_PORT_OVERTEMPERATURE_IS_FAULTY(23042, "充电端口过温故障"),
    AC_CIRCUIT_BREAKER_1_IS_FAULTY(23043, "交流断路器1故障"),
    AC_CIRCUIT_BREAKER_2_IS_FAULTY(23044, "交流断路器2故障"),
    AC_CIRCUIT_BREAKER_3_IS_FAULTY(23045, "交流断路器3故障"),
    AC_CIRCUIT_BREAKER_4_IS_FAULTY(23046, "交流断路器4故障"),
    AC_CIRCUIT_BREAKER_5_IS_FAULTY(23047, "交流断路器5故障"),
    AC_CIRCUIT_BREAKER_6_IS_FAULTY(23048, "交流断路器6故障"),
    INSULATION_DETECTION_FAULT(23049, "绝缘检测故障"),
    TERMINAL_FLOODING(23050, "终端水浸"),
    TOPPLE_AND_FALL(23051, "倾倒"),
    EMERGENCY_STOP(23052, "急停"),
    THE_DOOR_OPENS(23053, "门开"),
    WATER_FLOODING(23054, "温控--水浸"),
    ULTRALOW_TEMPERATURE(23055, "温控--超低温"),
    CHARGING_CONTROLLER_COMMUNICATION_FAILED(23056, "充电控制器通信失败"),
    THE_GUN_DRAW_CODE_ADDRESS_IS_ABNORMAL(23057, "枪拔码地址异常"),
    GUN_DC_OUTPUT_CONTACTOR_IS_FAULTY(23058, "枪直流输出接触器故障"),
    GOOSE_MESSAGE_TIMED_OUT(23059, "GOOSE报文超时"),
    OPERATION_DISABLE(23060, "运营禁用"),
    THE_CHARGING_PORT_IS_NOT_MATCHED(23061, "未匹配充电端口"),
    GOOSE_REQUESTS_VOLTAGE_TIMEOUT(23062, "GOOSE请求电压超时(主机超时未收到GOOSE消息）"),
    TERMINAL_HOT_RESET(23063, "终端热复位"),
    SEND_SIGNAL_TIMEOUT(23064, "下发信号超时"),
    TIMEOUT_BETWEEN_OPERATING_PLUGINS_AND_CHARGE_MANAGEMENT(23071, "运营插件和充电管理之间的超时"),

    /**
     * 系统异常
     */
    UNKNOWN_ERROR_CAUSE(23499, "未知错误原因"),
    ;

    private Integer code;

    private String reason;

    public Integer getCode() {
        return code;
    }

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

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    StartFailedReasonEnum(Integer code, String reason) {
        this.code = code;
        this.reason = reason;
    }

    /**
     * 根据 code 获取 reason
     *
     * @param code 编码
     * @return reason
     */
    public static String getReasonByCode(Integer code) {
        for (StartFailedReasonEnum item : StartFailedReasonEnum.values()) {
            if (item.getCode().equals(code)) {
                return item.getReason();
            }
        }
        return null;
    }
}
