package cn.yyxx.eyuancomm.comm.network

import android.content.Context
import cn.yyxx.support.HostModelUtils

/**
 * @author #Suyghur.
 * Created on 2022/01/25
 */
object Host {

    private var DEFAULT_ONLINE_HOST = "https://yhsdkapi.eyuangame.com"
    private var DEFAULT_TEST_HOST = "https://yhtestsdkapi.eyuangame.com"

    var HOST = ""

    /**
     * 默认线上环境
     */
    var IP_MODEL = 3

    const val BASIC_ROUTE_INIT_SDK = "activate"
    const val BASIC_ROUTE_USER_VERIFY = "login_verify"
    const val BASIC_ROUTE_CREATE_ORDER = "order_init"
    const val BASIC_ROUTE_NOTIFY_ORDER = "order_notify"
    const val BASIC_ROUTE_ORDER_STATUS = "order_status"

    fun initHostModel(context: Context) {
        IP_MODEL = HostModelUtils.getHostModel(context)
        setDefaultHost()
    }

    private fun setDefaultHost() {
        HOST = when (IP_MODEL) {
            HostModelUtils.ENV_TEST -> DEFAULT_TEST_HOST
            HostModelUtils.ENV_ONLINE -> DEFAULT_ONLINE_HOST
            else -> DEFAULT_ONLINE_HOST
        }
    }
}