// Path: data/src/main/java/eu/rampsoftware/er/data/datasource/remote/CurrencyDataApi.java
// public interface CurrencyDataApi {
// 
//     @GET("/historical/{date}.json")
//     Observable<Response<CurrencyList>> getCurrencies(@Path("date") String date,
//                                                      @Query("app_id") String appId);
// }
// 
// Path: presentation/src/main/java/eu/rampsoftware/er/properties/ApplicationProperties.java
// public interface ApplicationProperties {
//     String baseUrl();
// 
//     boolean logsEnabled();
// 
//     String getOerAppId();
// 
//     String sharedPreferencesName();
// }


import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
import eu.rampsoftware.er.data.datasource.remote.CurrencyDataApi;
import eu.rampsoftware.er.properties.ApplicationProperties;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

        HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
        if (propertiesManager.logsEnabled()) {
            loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
        } else {
            loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.NONE);
        }

        return new OkHttpClient.Builder()
                .addInterceptor(loggingInterceptor)
                .build();
    }

    @Override
    @Provides
    @Singleton
    public Retrofit provideRetrofit(Gson gson, ApplicationProperties propertiesManager, OkHttpClient client) {

        return new Retrofit.Builder()
                .baseUrl(propertiesManager.baseUrl())
                .addConverterFactory(GsonConverterFactory.create(gson))
                .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
                .client(client)
                .build();
    }

    @Override
    @Provides
    @Singleton
    public CurrencyDataApi provideCurrencyDataApi(Retrofit retrofit){
// Path: data/src/main/java/eu/rampsoftware/er/data/datasource/remote/CurrencyDataApi.java
// public interface CurrencyDataApi {
// 
//     @GET("/historical/{date}.json")
//     Observable<Response<CurrencyList>> getCurrencies(@Path("date") String date,
//                                                      @Query("app_id") String appId);
// }
// 
// Path: presentation/src/main/java/eu/rampsoftware/er/properties/ApplicationProperties.java
// public interface ApplicationProperties {
//     String baseUrl();
// 
//     boolean logsEnabled();
// 
//     String getOerAppId();
// 
//     String sharedPreferencesName();
// }


// Path: presentation/src/main/java/eu/rampsoftware/er/di/NetModule.java
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
import eu.rampsoftware.er.data.datasource.remote.CurrencyDataApi;
import eu.rampsoftware.er.properties.ApplicationProperties;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;


        HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
        if (propertiesManager.logsEnabled()) {
            loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
        } else {
            loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.NONE);
        }

        return new OkHttpClient.Builder()
                .addInterceptor(loggingInterceptor)
                .build();
    }

    @Override
    @Provides
    @Singleton
    public Retrofit provideRetrofit(Gson gson, ApplicationProperties propertiesManager, OkHttpClient client) {

        return new Retrofit.Builder()
                .baseUrl(propertiesManager.baseUrl())
                .addConverterFactory(GsonConverterFactory.create(gson))
                .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
                .client(client)
                .build();
    }

    @Override
    @Provides
    @Singleton
    public CurrencyDataApi provideCurrencyDataApi(Retrofit retrofit){
        return retrofit.create(CurrencyDataApi.class);