package com.rc.httpcore.config

import com.rc.httpcore.HttpConfig

class ConfigParam(builder: Builder) {

    val baseUrl: String = builder.baseUrl
    val signInCheckBaseUrl: String = builder.signInCheckBaseUrl

    val httpStrategy: Int = builder.httpStrategy

    val mqttServerUri: String = builder.mqttServerUri
    val mqttUName: String = builder.mqttUName
    val mqttUPwd: String = builder.mqttUPwd

    class Builder {
        internal var baseUrl: String
        internal var signInCheckBaseUrl: String
        internal var httpStrategy: Int
        internal var mqttServerUri: String
        internal var mqttUName: String
        internal var mqttUPwd: String

        init {
            baseUrl = "http://pc44sory.xiaomy.net:31738/"
            signInCheckBaseUrl = "http://180.76.134.43:931/"
            httpStrategy = HttpConfig.HTTP_STRATEGY_Retrofit
            mqttServerUri = "tcp://42.193.12.99:1883"
            mqttUName = "dlc"
            mqttUPwd = "123456"
        }

        fun baseUrl(baseUrl: String): Builder {
            this.baseUrl = baseUrl
            return this
        }

        fun signInCheckBaseUrl(signInCheckBaseUrl: String): Builder {
            this.signInCheckBaseUrl = signInCheckBaseUrl
            return this
        }

        fun httpStrategy(httpStrategy: Int): Builder {
            this.httpStrategy = httpStrategy
            return this
        }

        fun mqttServerUri(mqttServerUri: String): Builder {
            this.mqttServerUri = mqttServerUri
            return this
        }

        fun mqttUName(mqttUName: String): Builder {
            this.mqttUName = mqttUName
            return this
        }

        fun mqttUPwd(mqttUPwd: String): Builder {
            this.mqttUPwd = mqttUPwd
            return this
        }

        fun build(): ConfigParam {
            return ConfigParam(this)
        }

    }
}