package de.assecutor.votianlt.config;

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

@Configuration
@ConfigurationProperties(prefix = "app.mqtt")
public class MqttProperties {
    /** Enable/disable MQTT subsystem */
    private boolean enabled = true;
    /** Broker URI, e.g. tcp://192.168.180.26:1883 */
    private String brokerUri = "tcp://192.168.180.26:1883";
    /** ClientId for the server */
    private String clientId = "server";
    /** Optional username */
    private String username;
    /** Optional password */
    private String password;
    /** MQTT v5 clean start flag */
    private boolean cleanStart = false;
    /** Session expiry interval in seconds (0 = expire immediately) */
    private long sessionExpiryInterval = 24 * 60 * 60; // 1 day
    /** Keep alive in seconds */
    private int keepAlive = 30;
    /** Max inflight messages */
    private int maxInflight = 50;
    /** Automatic reconnect */
    private boolean automaticReconnect = true;
    /** Default QoS to use for publishing */
    private int defaultQos = 2;
    /** Default retained flag for publishing */
    private boolean defaultRetained = false;

    public boolean isEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public String getBrokerUri() {
        return brokerUri;
    }

    public void setBrokerUri(String brokerUri) {
        this.brokerUri = brokerUri;
    }

    public String getClientId() {
        return clientId;
    }

    public void setClientId(String clientId) {
        this.clientId = clientId;
    }

    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 isCleanStart() {
        return cleanStart;
    }

    public void setCleanStart(boolean cleanStart) {
        this.cleanStart = cleanStart;
    }

    public long getSessionExpiryInterval() {
        return sessionExpiryInterval;
    }

    public void setSessionExpiryInterval(long sessionExpiryInterval) {
        this.sessionExpiryInterval = sessionExpiryInterval;
    }

    public int getKeepAlive() {
        return keepAlive;
    }

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

    public int getMaxInflight() {
        return maxInflight;
    }

    public void setMaxInflight(int maxInflight) {
        this.maxInflight = maxInflight;
    }

    public boolean isAutomaticReconnect() {
        return automaticReconnect;
    }

    public void setAutomaticReconnect(boolean automaticReconnect) {
        this.automaticReconnect = automaticReconnect;
    }

    public int getDefaultQos() {
        return defaultQos;
    }

    public void setDefaultQos(int defaultQos) {
        this.defaultQos = defaultQos;
    }

    public boolean isDefaultRetained() {
        return defaultRetained;
    }

    public void setDefaultRetained(boolean defaultRetained) {
        this.defaultRetained = defaultRetained;
    }
}
