package com.ruoyi.device.config;

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

import java.util.ArrayList;
import java.util.List;

/**
 * MQTT配置信息
 *
 * @author lwm
 */
@Configuration
@ConfigurationProperties(prefix = "emqx")
public class MqttConfig
{
    /**
     * emqx服务器地址
     */
    private String broker;

    /**
     * 用户名
     */
    private String userName;

    /**
     * 密码
     */
    private String password;

    /**
     * 设置是否清空session,这里如果设置为false表示服务器会保留客户端的连接记录，这里设置为true表示每次连接到服务器都以新的身份连接
     */
    private Boolean cleanSession = true;

    /**
     * 是否断线重连
     */
    private Boolean reconnect = true;

    /**
     * 连接超时时间
     */
    private Integer timeout = 20;

    /**
     * 心跳间隔
     */
    private Integer keepAlive = 10;

    /**
     * 接口调用登陆名
     */
    private String apiUserName;

    /**
     * 接口调用登陆密码
     */
    private String apiPassword;

    /**
     * 接口调用地址
     */
    private String apiPath;

    /**
     * topic对应消息监听器
     */
    private List<MessageRouter> messageRouters = new ArrayList<>();

    public String getBroker()
    {
        return broker;
    }

    public void setBroker(String broker)
    {
        this.broker = broker;
    }

    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 Boolean getCleanSession()
    {
        return cleanSession;
    }

    public void setCleanSession(Boolean cleanSession)
    {
        this.cleanSession = cleanSession;
    }

    public Boolean getReconnect()
    {
        return reconnect;
    }

    public void setReconnect(Boolean reconnect)
    {
        this.reconnect = reconnect;
    }

    public Integer getTimeout()
    {
        return timeout;
    }

    public void setTimeout(Integer timeout)
    {
        this.timeout = timeout;
    }

    public Integer getKeepAlive()
    {
        return keepAlive;
    }

    public void setKeepAlive(Integer keepAlive)
    {
        this.keepAlive = keepAlive;
    }

    public String getApiUserName()
    {
        return apiUserName;
    }

    public void setApiUserName(String apiUserName)
    {
        this.apiUserName = apiUserName;
    }

    public String getApiPassword()
    {
        return apiPassword;
    }

    public void setApiPassword(String apiPassword)
    {
        this.apiPassword = apiPassword;
    }

    public String getApiPath()
    {
        return apiPath;
    }

    public void setApiPath(String apiPath)
    {
        this.apiPath = apiPath;
    }

    public List<MessageRouter> getMessageRouters()
    {
        return messageRouters;
    }

    public void setMessageRouters(List<MessageRouter> messageRouters)
    {
        this.messageRouters = messageRouters;
    }
}
