// Path: app/src/internalDebug/java/com/jakewharton/u2020/data/NetworkErrorCode.java
// public enum NetworkErrorCode {
//   HTTP_403(403),
//   HTTP_404(404),
//   HTTP_500(500),
//   HTTP_501(501),
//   HTTP_503(503),
//   HTTP_504(504),
//   ;
// 
//   public final int code;
// 
//   NetworkErrorCode(int code) {
//     this.code = code;
//   }
// 
//   @Override public String toString() {
//     return "HTTP " + code;
//   }
// }


import android.content.SharedPreferences;
import com.f2prateek.rx.preferences.Preference;
import com.jakewharton.u2020.data.ApiEndpoint;
import com.jakewharton.u2020.data.IsMockMode;
import com.jakewharton.u2020.data.NetworkDelay;
import com.jakewharton.u2020.data.NetworkErrorCode;
import com.jakewharton.u2020.data.NetworkErrorPercent;
import com.jakewharton.u2020.data.NetworkFailurePercent;
import com.jakewharton.u2020.data.NetworkVariancePercent;
import com.jakewharton.u2020.data.api.oauth.OauthInterceptor;
import dagger.Module;
import dagger.Provides;
import javax.inject.Named;
import javax.inject.Singleton;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.ResponseBody;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.mock.MockRetrofit;
import retrofit2.mock.NetworkBehavior;
import timber.log.Timber;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
package com.jakewharton.u2020.data.api;



@Module(
    complete = false,
    library = true,
    overrides = true
)
public final class DebugApiModule {
  @Provides @Singleton HttpUrl provideHttpUrl(@ApiEndpoint Preference<String> apiEndpoint) {
    return HttpUrl.parse(apiEndpoint.get());
  }

  @Provides @Singleton HttpLoggingInterceptor provideLoggingInterceptor() {
    HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(message -> Timber.tag("OkHttp").v(message));
    loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.HEADERS);
    return loggingInterceptor;
  }

  @Provides @Singleton @Named("Api") OkHttpClient provideApiClient(OkHttpClient client,
      OauthInterceptor oauthInterceptor, HttpLoggingInterceptor loggingInterceptor) {
    return ApiModule.createApiClient(client, oauthInterceptor)
        .addInterceptor(loggingInterceptor)
        .build();
  }

  @Provides @Singleton NetworkBehavior provideBehavior(@NetworkDelay Preference<Long> networkDelay,
      @NetworkVariancePercent Preference<Integer> networkVariancePercent,
      @NetworkFailurePercent Preference<Integer> networkFailurePercent,
      @NetworkErrorPercent Preference<Integer> networkErrorPercent,
// Path: app/src/internalDebug/java/com/jakewharton/u2020/data/NetworkErrorCode.java
// public enum NetworkErrorCode {
//   HTTP_403(403),
//   HTTP_404(404),
//   HTTP_500(500),
//   HTTP_501(501),
//   HTTP_503(503),
//   HTTP_504(504),
//   ;
// 
//   public final int code;
// 
//   NetworkErrorCode(int code) {
//     this.code = code;
//   }
// 
//   @Override public String toString() {
//     return "HTTP " + code;
//   }
// }


// Path: app/src/internalDebug/java/com/jakewharton/u2020/data/api/DebugApiModule.java
import android.content.SharedPreferences;
import com.f2prateek.rx.preferences.Preference;
import com.jakewharton.u2020.data.ApiEndpoint;
import com.jakewharton.u2020.data.IsMockMode;
import com.jakewharton.u2020.data.NetworkDelay;
import com.jakewharton.u2020.data.NetworkErrorCode;
import com.jakewharton.u2020.data.NetworkErrorPercent;
import com.jakewharton.u2020.data.NetworkFailurePercent;
import com.jakewharton.u2020.data.NetworkVariancePercent;
import com.jakewharton.u2020.data.api.oauth.OauthInterceptor;
import dagger.Module;
import dagger.Provides;
import javax.inject.Named;
import javax.inject.Singleton;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.ResponseBody;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.mock.MockRetrofit;
import retrofit2.mock.NetworkBehavior;
import timber.log.Timber;
import static java.util.concurrent.TimeUnit.MILLISECONDS;

package com.jakewharton.u2020.data.api;



@Module(
    complete = false,
    library = true,
    overrides = true
)
public final class DebugApiModule {
  @Provides @Singleton HttpUrl provideHttpUrl(@ApiEndpoint Preference<String> apiEndpoint) {
    return HttpUrl.parse(apiEndpoint.get());
  }

  @Provides @Singleton HttpLoggingInterceptor provideLoggingInterceptor() {
    HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(message -> Timber.tag("OkHttp").v(message));
    loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.HEADERS);
    return loggingInterceptor;
  }

  @Provides @Singleton @Named("Api") OkHttpClient provideApiClient(OkHttpClient client,
      OauthInterceptor oauthInterceptor, HttpLoggingInterceptor loggingInterceptor) {
    return ApiModule.createApiClient(client, oauthInterceptor)
        .addInterceptor(loggingInterceptor)
        .build();
  }

  @Provides @Singleton NetworkBehavior provideBehavior(@NetworkDelay Preference<Long> networkDelay,
      @NetworkVariancePercent Preference<Integer> networkVariancePercent,
      @NetworkFailurePercent Preference<Integer> networkFailurePercent,
      @NetworkErrorPercent Preference<Integer> networkErrorPercent,
      Preference<NetworkErrorCode> networkErrorCode) {