package com.usky.eg.mqtt;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * 远程升级 MQTT 下发（服务端发布，终端 {@code connectWithDevice} 订阅）。
 * <p>
 * 配置前缀 {@code eg.mqtt}；{@link com.usky.eg.controller.web.EgDeviceAdbController#remoteUpgrade} 仅通过本配置连接 Broker 并发布。
 */
@ConfigurationProperties(prefix = "eg.mqtt")
public class EgMqttProperties {

    /** 例如 tcp://47.98.201.73:1883 */
    private String url = "tcp://47.98.201.73:1883";

    private String username = "usky";

    private String password = "usky";

    /**
     * 发布主题模板，须包含占位符 {@code {deviceId}}，与终端 {@code deviceId: getSerial()} 一致。
     * 示例：usky/device/{deviceId}/command
     */
    private String commandTopicTemplate = "usky/device/{deviceId}/command";

    /** 发布 QoS，0/1/2 */
    private int qos = 1;

    /**
     * 下发 JSON 中 {@code type} 字段，终端可在 {@code onCommand} 里按类型分支。
     */
    private String commandType = "egRemoteUpgrade";

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getCommandTopicTemplate() {
        return commandTopicTemplate;
    }

    public void setCommandTopicTemplate(String commandTopicTemplate) {
        this.commandTopicTemplate = commandTopicTemplate;
    }

    public int getQos() {
        return qos;
    }

    public void setQos(int qos) {
        this.qos = qos;
    }

    public String getCommandType() {
        return commandType;
    }

    public void setCommandType(String commandType) {
        this.commandType = commandType;
    }
}
