package com.gh.gamecenter.feature.retrofit

import com.gh.gamecenter.common.retrofit.BaseRetrofitManager
import com.gh.gamecenter.common.utils.EnvHelper
import com.gh.gamecenter.core.utils.SingletonHolder
import com.gh.gamecenter.feature.HaloApp

class RetrofitManager private constructor() : BaseRetrofitManager() {

    val api: ApiService
    val newApi: ApiService
    val wGameCPMApiService: WGameCPMApiService

    init {
        val context = HaloApp.getInstance().applicationContext
        val okHttpNormalConfig = getOkHttpConfig(context, 0, 2)
        api = provideService(okHttpNormalConfig, EnvHelper.getHost(), ApiService::class.java)
        newApi = provideService(okHttpNormalConfig, EnvHelper.getNewHost(), ApiService::class.java)
        wGameCPMApiService = provideService(okHttpNormalConfig, EnvHelper.getWGameCPMHost(), WGameCPMApiService::class.java)
    }

    companion object : SingletonHolder<RetrofitManager>(::RetrofitManager)
}