package com.ruoyi.mqtt.enums;

/**
 * 机器人行驶状态枚举
 */
public enum RobotRunState {
    
    NORMAL(1, "正常行驶状态"),
    PAUSED(2, "暂停状态"),
    STANDBY(3, "停车待命状态"),
    OBSTACLE_STOP(4, "遇障停车状态"),
    TRAFFIC_WAIT(5, "交通管制等待状态"),
    LOCALIZATION_SWITCH(6, "定位切换等待状态"),
    MANUAL_CONTROL(7, "人工接管状态"),
    OBSTACLE_AVOIDANCE(8, "绕障状态");
    
    private final int code;
    private final String description;
    
    RobotRunState(int code, String description) {
        this.code = code;
        this.description = description;
    }
    
    public int getCode() {
        return code;
    }
    
    public String getDescription() {
        return description;
    }
    
    public static RobotRunState fromCode(int code) {
        for (RobotRunState state : values()) {
            if (state.code == code) {
                return state;
            }
        }
        return null;
    }
}
