package com.tlongdev.bktf.module;

import android.content.Context;

import com.google.gson.Gson;
import com.tlongdev.bktf.R;
import com.tlongdev.bktf.network.BackpackTfInterface;
import com.tlongdev.bktf.network.FixerIoInterface;
import com.tlongdev.bktf.network.SteamUserInterface;
import com.tlongdev.bktf.network.Tf2Interface;

import javax.inject.Named;
import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * @author Long
 * @since 2016. 03. 10.
 */
@Module
public class NetworkModule {

    @Provides
    @Singleton
    @Named("tlongdev")
    Retrofit provideTlongdevRetrofit(Context context, Gson gson) {
        return new Retrofit.Builder()
                .baseUrl(context.getString(R.string.main_host) + "/bptf/legacy/")
                .addConverterFactory(GsonConverterFactory.create(gson))
                .build();
    }

    @Provides
    @Singleton
    @Named("backpack_tf")
    Retrofit provideBackpackTfRetrofit(Gson gson) {
        return new Retrofit.Builder()
                .baseUrl(BackpackTfInterface.BASE_URL)
                .addConverterFactory(GsonConverterFactory.create(gson))
                .build();
    }

    @Provides
    @Singleton
    @Named("steam_user")
    Retrofit provideSteamUserRetrofit(Gson gson) {
        return new Retrofit.Builder()
                .baseUrl(SteamUserInterface.BASE_URL)
                .addConverterFactory(GsonConverterFactory.create(gson))
                .build();
    }

    @Provides
    @Singleton
    @Named("tf2")
    Retrofit provideTf2Retrofit(Gson gson) {
        return new Retrofit.Builder()
                .baseUrl(Tf2Interface.BASE_URL)
                .addConverterFactory(GsonConverterFactory.create(gson))
                .build();
    }

    @Provides
    @Singleton
    @Named("fixer_io")
    Retrofit provideFixerIoRetrofit(Gson gson) {
        return new Retrofit.Builder()
                .baseUrl(FixerIoInterface.BASE_URL)
                .addConverterFactory(GsonConverterFactory.create(gson))
                .build();
    }

    @Provides
    @Singleton
    BackpackTfInterface provideBackpackTfInterface(@Named("backpack_tf") Retrofit retrofit) {
        return retrofit.create(BackpackTfInterface.class);
    }

    @Provides
    @Singleton
    SteamUserInterface provideSteamUserInterface(@Named("steam_user") Retrofit retrofit) {
        return retrofit.create(SteamUserInterface.class);
    }

    @Provides
    @Singleton
    Tf2Interface provideTf2Interface(@Named("tf2") Retrofit retrofit) {
        return retrofit.create(Tf2Interface.class);
    }

    @Provides
    @Singleton
    FixerIoInterface provideFixerIoInterface(@Named("fixer_io") Retrofit retrofit) {
        return retrofit.create(FixerIoInterface.class);
    }
}

@@ -39,89 +39,28 @@
 ort 
-android.content.Context;%0A%0Aimport com.google.gson.Gson;%0Aimport com.tlongdev.bktf.R
+com.google.gson.Gson
 ;%0Aim
@@ -540,352 +540,8 @@
  %7B%0A%0A
-    @Provides%0A    @Singleton%0A    @Named(%22tlongdev%22)%0A    Retrofit provideTlongdevRetrofit(Context context, Gson gson) %7B%0A        return new Retrofit.Builder()%0A                .baseUrl(context.getString(R.string.main_host) + %22/bptf/legacy/%22)%0A                .addConverterFactory(GsonConverterFactory.create(gson))%0A                .build();%0A    %7D%0A%0A
     

remove unused legacy retrofit