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

/**
 * 停止充电失败原因
 *
 * @author Lemon
 * @Date 2024/1/30 13:36:48
 */
public enum StopFailedReasonEnum {
    THIS_DEVICE_DOES_NOT_EXIST(1, "此设备不存在"),
    THIS_DEVICE_IS_OFFLINE(2, "此设备离线"),
    THE_DEVICE_HAS_STOPPED_CHARGING(3, "设备已停止充电"),

    /**
     * 车侧正常停止
     */
    ACHIEVE_THE_REQUIRED_SOC_TARGET_VALUE(24500, "达到所需求的SOC目标值"),
    REACH_THE_SET_VALUE_OF_THE_TOTAL_VOLTAGE(24501, "达到总电压的设定值"),
    THE_SET_VALUE_OF_THE_CELL_VOLTAGE_IS_REACHED(24502, "达到单体电压的设定值"),
    OTHER_REASONS(24503, "车侧主动停止-其他原因"),

    /**
     * 桩侧正常停止
     */
    FULL_STOP_RESERVED(24504, "充满停止--预留"),
    TOUCH_SCREEN_MANUALLY_STOP(24505, "触控屏手动停止"),
    THE_OPERATION_PLATFORM_IS_MANUALLY_STOPPED(24506, "后台停止充电--运营平台手动停止"),
    THE_CHARGING_TIME_STOPS_WHEN_THE_SETTING_IS_REACHED(24507, "达到设置充电时长停止"),
    CHARGING_STOPS_WHEN_THE_SETTING_IS_REACHED(24508, "达到设置充电电量停止"),
    THE_CHARGING_AMOUNT_STOPS_WHEN_THE_SETTING_IS_REACHED(24509, "达到设置充电金额停止"),
    THE_OFFLINE_SOC_SHUTDOWN_CONDITION_IS_ACHIEVED(24510, "达到离线SOC停机条件"),
    OFFLINE_CHARGING_TIME_SHUTDOWN_CONDITION_IS_REACHED(24511, "达到离线充电时间停机条件"),
    STOP_WHEN_SOC_TERMINATION_CONDITION_IS_REACHED(24512, "达到SOC终止条件停止"),
    INSUFFICIENT_BALANCE_AUTOMATICALLY_STOPS(24513, "余额不足自动停止"),
    THE_METER_VALUE_IS_ABNORMAL(24514, "电表值异常"),
    DISCONNECT_WITH_PLATFORM_STOP(24515, "与平台断链停止"),
    SCAN_STOP(24516, "扫码停止"),
    SWIPE_STOP(24517, "刷卡停止"),

    /**
     * 车侧异常
     */
    RECEIVING_THE_BHM_TIMED_OUT(24518, "接收BHM超时"),
    THE_BHM_VOLTAGE_IS_TOO_LOW(24519, "BHM电压过低"),
    THE_VEHICLE_DID_NOT_REPLY_TO_THE_HANDSHAKE(24520, "车辆未回复握手"),
    RECEIVING_BCP_TIMED_OUT(24521, "接收BCP超时"),
    THE_BCP_BATTERY_VOLTAGE_IS_TOO_HIGH(24522, "BCP电池电压过高"),
    THE_BCP_BATTERY_VOLTAGE_IS_TOO_LOW(24523, "BCP电池电压过低"),
    DESCRIPTION_FAILED_TO_DETERMINE_THE_BCP_BATTERY_VOLTAGE(24524, "BCP电池电压判断失败"),
    RECEIVE_BRO_TIMEOUT(24525, "接收BRO超时"),
    RECEIVE_BRO_AA_TIMEOUT(24526, "接收BRO AA超时"),
    THE_DETECTED_BCP_BATTERY_VOLTAGE_IS_INCONSISTENT_WITH_THAT_REPORTED(24527, "BCP电池检测电压与上报不一致"),
    BMS_BATTERY_REVERSE_CONNECTION(24528, "BMS电池反接"),
    THE_BRO_00_PACKET_WAS_INCORRECTLY_RECEIVED(24529, "误接收BRO 00报文"),
    THE_MAXIMUM_ALLOWABLE_VOLTAGE_OF_THE_BCP_IS_LESS_THAN_THE_MINIMUM_OUTPUT_VOLTAGE(24530, "BCP最大允许电压小于模块最小输出电压"),
    RECEIVING_THE_BCL_TIMED_OUT(24531, "接收BCL超时"),
    RECEIVING_THE_BCS_TIMED_OUT(24532, "接收BCS超时"),
    THE_BCL_VOLTAGE_EXCEEDS_THE_UPPER_LIMIT_OF_THE_BCP(24533, "BCL电压超过BCP上限"),
    THE_BCL_CURRENT_EXCEEDS_THE_UPPER_LIMIT_OF_THE_BCP(24534, "BCL电流超过BCP上限"),
    THE_BCL_VOLTAGE_IS_LOWER_THAN_THE_MODULE_LOWER_LIMIT(24535, "BCL电压低于模块下限"),
    BCS_BATTERY_VOLTAGE_IS_TOO_HIGH(24536, "BCS单体电池电压过高(桩判断)"),
    THE_BSM_TEMPERATURE_IS_TOO_HIGH(24537, "BSM温度过高(桩判断)"),
    THE_BSM_BATTERY_VOLTAGE_IS_TOO_HIGH(24538, "BSM单体电池电压过高"),
    THE_BSM_BATTERY_VOLTAGE_IS_TOO_LOW(24539, "BSM单体电池电压过低"),
    THE_BSM_VEHICLE_SOC_IS_TOO_HIGH(24540, "BSM整车SOC过高"),
    THE_BSM_VEHICLE_SOC_IS_TOO_LOW(24541, "BSM整车SOC过低"),
    THE_CURRENT_OF_THE_BSM_BATTERY_IS_TOO_HIGH(24542, "BSM电池电流过高"),
    THE_TEMPERATURE_OF_THE_BSM_BATTERY_IS_TOO_HIGH(24543, "BSM蓄电池温度过高"),
    THE_BSM_INSULATION_IS_ABNORMAL(24544, "BSM绝缘异常"),
    THE_BSM_OUTPUT_CONNECTOR_IS_FAULTY(24545, "BSM输出连接器故障"),
    THE_BMV_BATTERY_VOLTAGE_IS_TOO_HIGH(24546, "BMV单体电池电压过高"),
    THE_TEMPERATURE_OF_THE_BMT_BATTERY_IS_TOO_HIGH(24547, "BMT单体电池温度过高"),
    THE_CHARGING_REQUIREMENT_VOLTAGE_OR_CURRENT_IS_TOO_LOW(24548, "充电需求电压/电流过低"),
    THE_RECEIVED_BST_TIMED_OUT(24549, "接收BST超时"),
    THE_RECEIVED_BSD_TIMED_OUT(24550, "接收BSD超时"),
    THE_BST_CHARGING_CURRENT_IS_TOO_LARGE(24551, "BST充电电流过大"),
    THE_BST_CHARGING_VOLTAGE_IS_ABNORMAL(24552, "BST充电电压异常"),
    BST_INSULATION_FAULT(24553, "BST绝缘故障"),
    THE_BST_CONNECTOR_IS_OVERHEATED(24554, "BST连接器过温"),
    THE_BST_COMPONENT_IS_OVERHEATED(24555, "BST元件过温"),
    THE_BST_CHARGING_CONNECTOR_IS_FAULTY(24556, "BST充电连接器故障"),
    THE_TEMPERATURE_OF_THE_BST_BATTERY_STRING_IS_TOO_HIGH(24557, "BST电池组温度过高"),
    THE_BST_HIGH_VOLTAGE_RELAY_IS_FAULTY(24558, "BST高压继电器故障"),
    BST_DETECTION_POINT_2_IS_FAULTY(24559, "BST检测点2故障"),
    BST_OTHER_FAULTS(24560, "BST其他故障"),
    K5_K6_DISCONNECT_FAILED(24561, "K5K6断开失败"),
    THE_BMS_COMMUNICATION_IS_INTERRUPTED(24562, "BMS通信中断"),


    /**
     * 用户操作停止
     */
    GUN_WAS_NOT_PLUGGED_IN_FAILED_TO_LOCK(24563, "枪未插好，上锁失败"),
    DRAW_OUT(24606, "拔枪终止"),
    THE_OWNER_ACTIVELY_UNLOCKS_AND_STOPS(24622, "车主主动解锁停止"),

    /**
     * 枪侧异常停止
     */
    THE_AUXILIARY_POWER_TIMED_OUT_BEFORE_STARTUP(24564, "启动前辅源上电超时"),
    THE_FRONT_END_VOLTAGE_IS_TOO_LARGE(24565, "握手前-前级电压过大"),
    VOLTAGE_COLLECTION_AFTER_INSULATION_DETECTION_TIMES_OUT(24566, "绝缘检测后级电压采集超时"),
    VOLTAGE_COLLECTION_BEFORE_INSULATION_DETECTION_TIMED_OUT(24567, "绝缘检测前级电压采集超时"),
    THE_VOLTAGE_BEFORE_AND_AFTER_THE_INSULATION_TEST_IS_TOO_HIGH(24568, "绝缘检测前后级电压过大"),
    THE_INSULATION_DETECTION_VOLTAGE_IS_INVALID(24569, "绝缘检测电压无效"),
    THE_INSULATION_DETECTION_VOLTAGE_IS_ABNORMAL(24570, "绝缘检测电压异常"),
    CONTACTOR_ADHESION_IS_ABNORMAL(24571, "接触器粘连异常"),
    INSULATION_DETECTION_TIMEOUT(24572, "绝缘检测超时"),
    INSULATION_DETECTION_CONTACTOR_CLOSING_TIMEOUT(24573, "绝缘检测接触器闭合超时"),
    THE_VOLTAGE_IS_ABNORMAL_DURING_THE_INSULATION_TEST(24574, "绝缘检测过程中电压异常"),
    ABNORMAL_INSULATION_DETECTION(24575, "绝缘检测异常"),
    INSULATION_DETECTION_FAULT(24576, "绝缘检测故障"),
    PRE_RELEASE_VOLTAGE_COLLECTION_TIMEOUT(24577, "泄放前级电压采集超时"),
    RELEASE_TIMEOUT(24578, "泄放超时"),
    THE_BUS_IS_REVERSED(24579, "母线反接"),
    IDENTIFICATION_PHASE_CONTACTOR_DISCONNECT_TIMEOUT(24580, "辨识阶段接触器断开超时"),
    THE_PRESET_PRESSURE_TIMES_OUT(24581, "预调压超时"),
    CHARGING_STATE_CLOSED_CONTACTOR_TIMEOUT(24582, "充电状态闭合接触器超时"),
    THE_METER_COLLECTION_IS_ABNORMAL(24583, "电表采集异常"),
    NO_POWER_OUTPUT(24584, "无功率输出"),
    CHARGE_TIMEOUT(24585, "充电暂停超时"),
    CHARGE_END_DRAIN_TIMEOUT(24586, "充电结束泄放超时"),
    UNLOCKING_FAILURE(24587, "解锁失败"),
    CONTACTOR_DISCONNECTION_FAILED(24588, "接触器断开失败"),
    SECONDARY_SOURCE_SHUTDOWN_EXCEPTION(24589, "辅源关闭异常"),
    FLOODING_FAULT(24590, "水浸故障"),
    DOOR_STATUS_FAILURE(24591, "门磁故障"),
    TIPPING_FAULT(24592, "倾倒故障"),
    SCRAM_FAULT(24593, "急停故障"),
    EQUIPMENT_DETECTION_ELECTRONIC_LOCK_FAILURE(24594, "电子锁故障(设备检测)"),
    GUN_CONTROL_PANEL_COMMUNICATION_FAILED(24595, "枪控板通信失败"),
    METERING_FAULT(24596, "计量故障"),
    METER_COMMUNICATION_FAILED(24597, "电表通信失败"),
    CHARGING_CONTROLLER_COMMUNICATION_FAILED(24598, "充电控制器通信失败"),
    THE_DIP_ADDRESS_IS_ABNORMAL(24599, "拨码地址异常"),
    CONTROL_GUIDANCE_FAULT(24600, "控制导引故障(定时器轮询)"),
    OUTPUT_VOLTAGE_ANOMALY(24601, "输出电压异常"),
    OUTPUT_CURRENT_ANOMALY(24602, "输出电流异常"),
    AUXILIARY_POWER_FAILURE(24603, "辅助电源故障(定时器轮询)"),
    THE_OUTPUT_FUSE_IS_ABNORMAL(24604, "输出熔断器异常"),
    GUN_HEAD_DC_POSITIVE_TEMPERATURE_SENSOR_IS_NOT_CONNECTED(24607, "枪-枪头DC正极温度传感器未接"),
    GUN_HEAD_DC_NEGATIVE_TEMPERATURE_SENSOR_IS_NOT_CONNECTED(24608, "枪-枪头DC负极温度传感器未接"),
    GUN_HEAD_DC_POSITIVE_TEMPERATURE_SENSOR_IS_FAULTY(24609, "枪-枪头DC正极温度传感器故障"),
    GUN_HEAD_DC_NEGATIVE_TEMPERATURE_SENSOR_IS_FAULTY(24610, "枪-枪头DC负极温度传感器故障"),
    GUN_HEAD_DC_POSITIVE_ELECTRODE_OVERTEMPERATURE_FAULT(24611, "枪-枪头DC正极过温故障"),
    GUN_HEAD_DC_NEGATIVE_ELECTRODE_OVERTEMPERATURE_FAULT(24612, "枪-枪头DC负极过温故障"),
    THE_POSITIVE_TEMPERATURE_SENSOR_INSIDE_THE_GUN_HEAD_IS_FAULTY(24613, "枪-枪头内部正极温度传感器故障"),
    THE_NEGATIVE_TEMPERATURE_SENSOR_INSIDE_THE_GUN_HEAD_IS_FAULTY(24614, "枪-枪头内部负极温度传感器故障"),
    GUN_HEAD_INTERNAL_POSITIVE_ELECTRODE_OVERTEMPERATURE_FAULT(24615, "枪-枪头内部正极过温故障"),
    GUN_HEAD_INTERNAL_NEGATIVE_ELECTRODE_OVERTEMPERATURE_FAULT(24616, "枪-枪头内部负极过温故障"),
    GUN_LINE_TAIL_POSITIVE_OVERTEMPERATURE_FAULT(24617, "枪-枪线尾部正极过温故障"),
    GUN_LINE_TAIL_NEGATIVE_ELECTRODE_OVERTEMPERATURE_FAULT(24618, "枪-枪线尾部负极过温故障"),
    THE_POSITIVE_LAP_POINT_OF_THE_COPPER_BAR_IS_OVERHEATED(24619, "枪-铜排正极搭接点过温故障"),
    THE_TEMPERATURE_OF_THE_NEGATIVE_LAP_POINT_OF_THE_COPPER_BAR_IS_TOO_HIGH(24620, "枪-铜排负极搭接点过温故障"),
    UNKNOWN_SYSTEM_TYPE(24621, "未知系统类型"),
    THE_TEMPERATURE_CONTROL_IS_ABNORMAL_NEEDS_STOP_CHARGING(24623, "温控异常需要停止充电"),
    GUN_TEMPERATURE_ANOMALY(24624, "枪温度异常"),
    GUN_HEAD_MOUNTED_ABNORMALLY(24626, "枪头安装异常"),

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

    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;
    }

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

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