package com.ruoyi.mqtt.constant;

/**
 * MQTT主题常量类
 * 根据LD导航系统MQTT接口规范定义
 * 主题格式: /${ProductID}/${DeviceID}/${ShortTopic}
 */
public class MqttTopicConstants {
    
    // ==================== 地图相关主题 ====================
    
    /**
     * 请求地图列表 (订阅)
     * QoS: 2, Retain: 0
     */
    public static final String MAP_SERVICE_MAPLIST_REQUEST = "/map/service/maplist/request";
    
    /**
     * 请求地图列表响应 (发布)
     * QoS: 2, Retain: 0
     */
    public static final String MAP_SERVICE_MAPLIST_RESPONSE = "/map/service/maplist/response";
    
    /**
     * 当前地图 (发布)
     * QoS: 2, Retain: 1
     */
    public static final String MAP_PROPERTY_CURRENT_MAP = "/map/property/current_map";
    
    // ==================== 定位相关主题 ====================
    
    /**
     * 机器人实时位姿 (发布)
     * QoS: 0, Retain: 0
     */
    public static final String LOCALIZATION_POSE = "/localization/pose";
    
    /**
     * 位姿初始化 (订阅)
     * QoS: 2, Retain: 0
     */
    public static final String LOCALIZATION_ACTION_INIT = "/localization/action/init";
    
    /**
     * 位姿初始化响应 (发布)
     * QoS: 2, Retain: 0
     */
    public static final String LOCALIZATION_ACTION_INIT_REPLY = "/localization/action/init/reply";
    
    // ==================== 导航相关主题 ====================
    
    /**
     * 开启导航 (订阅)
     * QoS: 2, Retain: 0
     */
    public static final String NAVIGATION_STACK_ACTION_START = "/navigation/stack/action/start";
    
    /**
     * 开启导航响应 (发布)
     * QoS: 2, Retain: 0
     */
    public static final String NAVIGATION_STACK_ACTION_START_REPLY = "/navigation/stack/action/start/reply";
    
    /**
     * 关闭导航 (订阅)
     * QoS: 2, Retain: 0
     */
    public static final String NAVIGATION_STACK_ACTION_STOP = "/navigation/stack/action/stop";
    
    /**
     * 关闭导航响应 (发布)
     * QoS: 2, Retain: 0
     */
    public static final String NAVIGATION_STACK_ACTION_STOP_REPLY = "/navigation/stack/action/stop/reply";
    
    /**
     * 重启导航 (订阅)
     * QoS: 2, Retain: 0
     */
    public static final String NAVIGATION_STACK_ACTION_RESTART = "/navigation/stack/action/restart";
    
    /**
     * 重启导航响应 (发布)
     * QoS: 2, Retain: 0
     */
    public static final String NAVIGATION_STACK_ACTION_RESTART_REPLY = "/navigation/stack/action/restart/reply";
    
    // ==================== 规划相关主题 ====================
    
    /**
     * 请求路径规划 (订阅)
     * QoS: 2, Retain: 0
     */
    public static final String PLANNING_SERVICE_PLAN_REQUEST = "/planning/service/plan/request";
    
    /**
     * 请求路径规划响应 (发布)
     * QoS: 2, Retain: 0
     */
    public static final String PLANNING_SERVICE_PLAN_RESPONSE = "/planning/service/plan/response";
    
    /**
     * 当前行驶轨迹 (发布)
     * QoS: 2, Retain: 1
     */
    public static final String PLANNING_TRAJECTORY = "/planning/trajectory";
    
    /**
     * 当前行驶轨迹-紧凑格式 (发布)
     * QoS: 2, Retain: 1
     */
    public static final String PLANNING_TRAJECTORY_2D_COMPACT = "/planning/trajectory/2d/compact";
    
    /**
     * 遇障重规划 (订阅)
     * QoS: 2, Retain: 0
     */
    public static final String PLANNING_ACTION_REPLAN = "/planning/action/replan";
    
    /**
     * 重规划响应 (发布)
     * QoS: 2, Retain: 0
     */
    public static final String PLANNING_ACTION_REPLAN_REPLY = "/planning/action/replan/reply";
    
    // ==================== 任务相关主题 ====================
    
    /**
     * 前往目标点 (订阅)
     * QoS: 2, Retain: 0
     */
    public static final String TASK_TARGET_ACTION_GOTO = "/task/target/action/goto";
    
    /**
     * 前往目标点响应 (发布)
     * QoS: 2, Retain: 0
     */
    public static final String TASK_TARGET_ACTION_GOTO_REPLY = "/task/target/action/goto/reply";
    
    /**
     * 到达目标点 (发布)
     * QoS: 2, Retain: 1
     */
    public static final String TASK_TARGET_EVENT_ARRIVE = "/task/target/event/arrive";
    
    /**
     * 任务实时状态信息 (发布)
     * QoS: 0, Retain: 0
     */
    public static final String TASK_REALTIME_INFO = "/task/realtime/info";
    
    /**
     * 暂停任务 (订阅)
     * QoS: 1, Retain: 0
     */
    public static final String TASK_PROCEDURE_ACTION_PAUSE = "/task/procedure/action/pause";
    
    /**
     * 暂停任务响应 (发布)
     * QoS: 2, Retain: 0
     */
    public static final String TASK_PROCEDURE_ACTION_PAUSE_REPLY = "/task/procedure/action/pause/reply";
    
    /**
     * 继续任务 (订阅)
     * QoS: 2, Retain: 0
     */
    public static final String TASK_PROCEDURE_ACTION_RESUME = "/task/procedure/action/resume";
    
    /**
     * 继续任务响应 (发布)
     * QoS: 2, Retain: 0
     */
    public static final String TASK_PROCEDURE_ACTION_RESUME_REPLY = "/task/procedure/action/resume/reply";
    
    /**
     * 取消任务 (订阅)
     * QoS: 1, Retain: 0
     */
    public static final String TASK_PROCEDURE_ACTION_CANCEL = "/task/procedure/action/cancel";

    /**
     * 启动任务 (订阅)
     * QoS: 2, Retain: 0
     */
    public static final String TASK_PROCEDURE_ACTION_START = "/task/procedure/action/start";
    
    /**
     * 取消任务响应 (发布)
     * QoS: 2, Retain: 0
     */
    public static final String TASK_PROCEDURE_ACTION_CANCEL_REPLY = "/task/procedure/action/cancel/reply";
    
    // ==================== ASM远程功能调用相关主题 ====================
    
    /**
     * 发起远程功能调用 (订阅)
     * QoS: 2, Retain: 0
     */
    public static final String ABILITY_FUNCTION_ACTION_EXEC = "/ability/function/action/exec";
    
    /**
     * 远程调用响应 (发布)
     * QoS: 2, Retain: 0
     */
    public static final String ABILITY_FUNCTION_ACTION_EXEC_REPLY = "/ability/function/action/exec/reply";
    
    /**
     * 远程调用进度反馈 (发布)
     * QoS: 0, Retain: 0
     */
    public static final String ABILITY_FUNCTION_ACTION_EXEC_PROGRESS = "/ability/function/action/exec/progress";
    
    /**
     * 远程调用状态反馈 (发布)
     * QoS: 2, Retain: 0
     */
    public static final String ABILITY_FUNCTION_ACTION_EXEC_STATE = "/ability/function/action/exec/state";
    
    // ==================== ASM功能名称常量 ====================
    
    /** 电池信息 (发布)
     * QoS: 0, Retain: 0
     */
    public static final String SENSOR_BATTERY = "/sensor/battery";
    
    /** 开始传感器录制 */
    public static final String ASM_SENSOR_RECORD_START = "ASM.sensor_record.start";
    
    /** 停止传感器录制 */
    public static final String ASM_SENSOR_RECORD_STOP = "ASM.sensor_record.stop";
    
    /** 开始地图构建 */
    public static final String ASM_MAP_BUILD_START = "ASM.map_build.start";
    
    /** 停止地图构建 */
    public static final String ASM_MAP_BUILD_STOP = "ASM.map_build.stop";
    
    /** 开始实时建图 */
    public static final String ASM_MAP_SLAM_START = "ASM.map_slam.start";
    
    /** 停止实时建图 */
    public static final String ASM_MAP_SLAM_STOP = "ASM.map_slam.stop";
    
    /** 启动标准导航 */
    public static final String ASM_NAV_STANDARD_START = "ASM.nav_standard.start";
    
    /** 结束标准导航 */
    public static final String ASM_NAV_STANDARD_STOP = "ASM.nav_standard.stop";

    // ==================== 车辆控制相关主题 ====================

    /**
     * 车辆急停控制 (订阅)
     * QoS: 2, Retain: 0
     */
    public static final String CONTROL_VEHICLE_ACTION_STOP = "/control/vehicle/action/stop";

    /**
     * 构建完整主题前缀（productId + deviceId）
     * @return 主题前缀: /${ProductID}/${DeviceID}
     */
    public static String buildPrefix(String productId, String deviceId) {
        return "/" + productId + "/" + deviceId;
    }
    
    /**
     * 构建完整主题（使用配置的前缀）
     * @param prefix 前缀（格式：/${productId}/${deviceId}）
     * @param shortTopic 短主题名
     * @return 完整主题
     */
    public static String buildTopic(String prefix, String shortTopic) {
        return prefix + shortTopic;
    }
    
    /**
     * 构建完整主题
     * @param productId 产品ID
     * @param deviceId 设备ID
     * @param shortTopic 短主题名
     * @return 完整主题: /${ProductID}/${DeviceID}/${ShortTopic}
     */
    public static String buildTopic(String productId, String deviceId, String shortTopic) {
        return "/" + productId + "/" + deviceId + shortTopic;
    }
    
  /*  *//**
     * 构建通配符订阅主题（使用配置的前缀，订阅所有设备）
     * @param prefix 前缀（格式：/${productId}）
     * @param shortTopic 短主题名
     * @return 通配符主题: /${ProductID}/+/${ShortTopic}
     *//*
    public static String buildWildcardTopic(String prefix, String shortTopic) {
        return prefix + "/+" + shortTopic;
    }
    
    *//**
     * 构建通配符订阅主题(订阅所有设备)
     * @param productId 产品ID
     * @param shortTopic 短主题名
     * @return 通配符主题: /${ProductID}/+/${ShortTopic}
     *//*
    public static String buildWildcardTopic(String productId, String shortTopic) {
        return "/" + productId + "/+" + shortTopic;
    }*/
}
