package com.ruoyi.mqtt.enums;

/**
 * 任务错误码枚举
 */
public enum TaskErrorCode {
    
    PLANNING_FAILED(21, "规划失败"),
    LANE_DEVIATION(22, "偏离车道线"),
    TASK_TERMINATED(23, "任务提前终止"),
    LOCALIZATION_ERROR(24, "定位异常,任务无法继续执行");
    
    private final int code;
    private final String description;
    
    TaskErrorCode(int code, String description) {
        this.code = code;
        this.description = description;
    }
    
    public int getCode() {
        return code;
    }
    
    public String getDescription() {
        return description;
    }
    
    public static TaskErrorCode fromCode(int code) {
        for (TaskErrorCode error : values()) {
            if (error.code == code) {
                return error;
            }
        }
        return null;
    }
}
