package com.gh.gamecenter.login.retrofit;

import android.content.Context;

import com.gh.gamecenter.common.retrofit.BaseRetrofitManager;
import com.gh.gamecenter.common.utils.EnvHelper;
import com.gh.gamecenter.login.HaloApp;

import okhttp3.OkHttpClient;

public class RetrofitManager extends BaseRetrofitManager {

    private final ApiService mApiService;

    private final ApiService mNewApiService;

    private RetrofitManager() {
        Context context = HaloApp.getInstance().getApplicationContext();
        OkHttpClient okHttpNormalConfig = getOkHttpConfig(context, 0, 2);
        mApiService = provideService(okHttpNormalConfig, EnvHelper.getHost(), ApiService.class);
        mNewApiService = provideService(okHttpNormalConfig, EnvHelper.getNewHost(), ApiService.class);
    }

    public static RetrofitManager getInstance() {
        return SingletonHolder.INSTANCE;
    }

    public ApiService getApi() {
        return mApiService;
    }

    public ApiService getNewApi() {
        return mNewApiService;
    }

    private static class SingletonHolder {
        private static final RetrofitManager INSTANCE = new RetrofitManager();
    }
}
