package com.muyu.domain.model;

import com.muyu.domain.ServerConfig;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ServerConfigModel {
    /**
     * 主机地址
     */
    private String host;

    /**
     * 端口号
     */
    private String port;
    /**
     * 负载地址
     */
    private String url;

    /**
     * 默认MOTT地址
     */
    private String defaultMqttAddr;

    /**
     * 默认MQTT主题
     */
    private String defaultMqttTopic;

    /**
     * 默认MOTT交付级别
     */
    private Integer defaultMqttQos;

    public static  ServerConfigModel serverConfigModelBuild(ServerConfig serverConfig){
        return builder()
                .host(serverConfig.getHost().trim())
                .port(serverConfig.getPort())
                .url(serverConfig.getUrl().trim())
                .defaultMqttAddr(serverConfig.getDefaultMqttAddr().trim())
                .defaultMqttTopic(serverConfig.getDefaultMqttTopic().trim())
                .defaultMqttQos(serverConfig.getDefaultMqttQos())
                .build();
    }
}
