package com.rc.httpcore.config

import com.rc.httpcore.HttpConfig

object ConfigCore {

    fun initConfig(config: ConfigParam?, baseUrlSp: String?, apiVersion: Int) {
        if (null != config) {
            HttpConfig.API_BASE_URL = if (baseUrlSp.isNullOrEmpty()) config.baseUrl else baseUrlSp
            HttpConfig.HTTP_STRATEGY = config.httpStrategy

            when (apiVersion) {
                HttpConfig.ApiVersion.V1.code -> {
                    HttpConfig.BASE_PATH_FACE = HttpConfig.BasePathV1.FACE
                    HttpConfig.BASE_PATH_BASE = HttpConfig.BasePathV1.BASE
                }
                HttpConfig.ApiVersion.V2.code -> {
                    HttpConfig.BASE_PATH_FACE = HttpConfig.BasePathV2.ALGORITHM
                    HttpConfig.BASE_PATH_BASE = HttpConfig.BasePathV2.BASE
                }
            }
        }
    }

}