// Path: app/src/main/java/com/ragdroid/dahaka/DahakaApplication.java
// public class DahakaApplication extends Application implements HasActivityInjector {
// 
//     @Inject DispatchingAndroidInjector<Activity> activityInjector;
//     @Inject UserManager userManager;
// 
//     public AppComponent getAppComponent() {
//         return appComponent;
//     }
// 
//     private AppComponent appComponent;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         DataBindingUtil.setDefaultComponent(buildDataBindingComponent());
//         createComponent();
//     }
// 
//     protected void createComponent() {
//         appComponent = DaggerAppComponent.builder().application(this).build();
//         appComponent.inject(this);
//     }
// 
//     private DataBindingComponent buildDataBindingComponent() {
//         return DaggerAppDataBindingComponent.builder().application(this).build();
//     }
// 
//     @Override
//     public AndroidInjector<Activity> activityInjector() {
//         return userManager.activityInjector();
//     }
// }
// 
// Path: app/src/main/java/com/ragdroid/dahaka/activity/AppBindingModule.java
// @Module(subcomponents = UserComponent.class)
// public abstract class AppBindingModule {
// 
//     @ContributesAndroidInjector(modules = LoginModule.class)
//     @ActivityScope
//     abstract LoginActivity loginActivity();
// }
// 
// Path: app/src/main/java/com/ragdroid/dahaka/api/ApiModule.java
// @Module
// public class ApiModule {
// 
// 
//     private static final long CACHE_SIZE = 10 * 1024 * 1024; //10 MB
// 
//     @Provides
//     @Singleton
//     public static HttpLoggingInterceptor getLoggingInterceptor() {
//         HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
//         loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
//         return loggingInterceptor;
//     }
// 
// 
//     @Provides
//     @Singleton
//     static Gson provideGson() {
//         GsonBuilder gsonBuilder = new GsonBuilder();
//         gsonBuilder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES);
//         return gsonBuilder.create();
//     }
// 
//     @Provides
//     @Singleton
//     static Cache provideOkhttpCache(Application application) {
//         return new Cache(application.getCacheDir(), CACHE_SIZE);
//     }
// 
//     @Provides
//     @Singleton
//     static Interceptor provideCacheOverrideInterceptor() {
//         return chain -> {
//             int maxStale = 60 * 60 * 24 * 7; // tolerate 1-week stale
//             return chain.proceed(chain.request())
//                     .newBuilder()
//                     .header("Cache-Control", "public, only-if-cached, max-age=" + maxStale)
//                     .build();
//         };
//     }
// 
//     @Provides
//     @Singleton
//     static OkHttpClient provideOkHttpClient(HttpLoggingInterceptor loggingInterceptor, Cache cache,
//                                      Interceptor cacheOverrideInterceptor) {
//         OkHttpClient.Builder builder = new OkHttpClient.Builder()
//                 .cache(cache)
//                 .addInterceptor(loggingInterceptor)
//                 .connectTimeout(60, TimeUnit.SECONDS)
//                 .readTimeout(60, TimeUnit.SECONDS)
//                 .writeTimeout(60, TimeUnit.SECONDS)
//                 .addNetworkInterceptor(cacheOverrideInterceptor);
//         return builder
//                 .build();
// 
//     }
// 
// 
//     @Provides
//     @Singleton
//     static Retrofit provideRetrofit(Gson gson, OkHttpClient okHttpClient) {
//         return new Retrofit.Builder()
//                 .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
//                 .addConverterFactory(GsonConverterFactory.create(gson))
//                 .baseUrl(getBaseUrl())
//                 .client(okHttpClient)
//                 .build();
//     }
// 
//     protected static String getBaseUrl() {
//         return "http://pokeapi.co/api/v2/";
//     }
// 
//     @Provides
//     @Singleton
//     public static PokemonService providePokemonService(Retrofit retrofit) {
//         return retrofit.create(PokemonService.class);
//     }
// 
// 
// }
// 
// Path: app/src/main/java/com/ragdroid/dahaka/user/UserComponent.java
// @UserScope
// @Subcomponent(modules = {UserBindingModule.class, AndroidSupportInjectionModule.class})
// public interface UserComponent extends AndroidInjector<DaggerApplication> {
//     void inject(UserManager userManager);
// 
// 
//     @Subcomponent.Builder
//     interface Builder {
// 
//         UserComponent build();
//         @BindsInstance
//         Builder pokeMon(Pokemon pokemon);
//     }
// 
// }


import android.app.Application;
import com.ragdroid.dahaka.DahakaApplication;
import com.ragdroid.dahaka.activity.AppBindingModule;
import com.ragdroid.dahaka.api.ApiModule;
import com.ragdroid.dahaka.user.UserComponent;
import javax.inject.Singleton;
import dagger.BindsInstance;
import dagger.Component;
import dagger.android.AndroidInjector;
import dagger.android.DaggerApplication;
import dagger.android.support.AndroidSupportInjectionModule;
package com.ragdroid.dahaka.app;





/**
 * Created by garimajain on 13/08/17.
 */
@Singleton
@Component(modules = {
        AppModule.class,
        ApiModule.class,
        AppBindingModule.class,
        AndroidSupportInjectionModule.class})
public interface AppComponent extends AndroidInjector<DaggerApplication> {


    UserComponent.Builder userBuilder();

    UserManager getUserManager();

    void inject(DahakaApplication instance);

    @Component.Builder
    interface Builder {

        AppComponent build();

        @BindsInstance
        Builder application(Application application);
// Path: app/src/main/java/com/ragdroid/dahaka/DahakaApplication.java
// public class DahakaApplication extends Application implements HasActivityInjector {
// 
//     @Inject DispatchingAndroidInjector<Activity> activityInjector;
//     @Inject UserManager userManager;
// 
//     public AppComponent getAppComponent() {
//         return appComponent;
//     }
// 
//     private AppComponent appComponent;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         DataBindingUtil.setDefaultComponent(buildDataBindingComponent());
//         createComponent();
//     }
// 
//     protected void createComponent() {
//         appComponent = DaggerAppComponent.builder().application(this).build();
//         appComponent.inject(this);
//     }
// 
//     private DataBindingComponent buildDataBindingComponent() {
//         return DaggerAppDataBindingComponent.builder().application(this).build();
//     }
// 
//     @Override
//     public AndroidInjector<Activity> activityInjector() {
//         return userManager.activityInjector();
//     }
// }
// 
// Path: app/src/main/java/com/ragdroid/dahaka/activity/AppBindingModule.java
// @Module(subcomponents = UserComponent.class)
// public abstract class AppBindingModule {
// 
//     @ContributesAndroidInjector(modules = LoginModule.class)
//     @ActivityScope
//     abstract LoginActivity loginActivity();
// }
// 
// Path: app/src/main/java/com/ragdroid/dahaka/api/ApiModule.java
// @Module
// public class ApiModule {
// 
// 
//     private static final long CACHE_SIZE = 10 * 1024 * 1024; //10 MB
// 
//     @Provides
//     @Singleton
//     public static HttpLoggingInterceptor getLoggingInterceptor() {
//         HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
//         loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
//         return loggingInterceptor;
//     }
// 
// 
//     @Provides
//     @Singleton
//     static Gson provideGson() {
//         GsonBuilder gsonBuilder = new GsonBuilder();
//         gsonBuilder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES);
//         return gsonBuilder.create();
//     }
// 
//     @Provides
//     @Singleton
//     static Cache provideOkhttpCache(Application application) {
//         return new Cache(application.getCacheDir(), CACHE_SIZE);
//     }
// 
//     @Provides
//     @Singleton
//     static Interceptor provideCacheOverrideInterceptor() {
//         return chain -> {
//             int maxStale = 60 * 60 * 24 * 7; // tolerate 1-week stale
//             return chain.proceed(chain.request())
//                     .newBuilder()
//                     .header("Cache-Control", "public, only-if-cached, max-age=" + maxStale)
//                     .build();
//         };
//     }
// 
//     @Provides
//     @Singleton
//     static OkHttpClient provideOkHttpClient(HttpLoggingInterceptor loggingInterceptor, Cache cache,
//                                      Interceptor cacheOverrideInterceptor) {
//         OkHttpClient.Builder builder = new OkHttpClient.Builder()
//                 .cache(cache)
//                 .addInterceptor(loggingInterceptor)
//                 .connectTimeout(60, TimeUnit.SECONDS)
//                 .readTimeout(60, TimeUnit.SECONDS)
//                 .writeTimeout(60, TimeUnit.SECONDS)
//                 .addNetworkInterceptor(cacheOverrideInterceptor);
//         return builder
//                 .build();
// 
//     }
// 
// 
//     @Provides
//     @Singleton
//     static Retrofit provideRetrofit(Gson gson, OkHttpClient okHttpClient) {
//         return new Retrofit.Builder()
//                 .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
//                 .addConverterFactory(GsonConverterFactory.create(gson))
//                 .baseUrl(getBaseUrl())
//                 .client(okHttpClient)
//                 .build();
//     }
// 
//     protected static String getBaseUrl() {
//         return "http://pokeapi.co/api/v2/";
//     }
// 
//     @Provides
//     @Singleton
//     public static PokemonService providePokemonService(Retrofit retrofit) {
//         return retrofit.create(PokemonService.class);
//     }
// 
// 
// }
// 
// Path: app/src/main/java/com/ragdroid/dahaka/user/UserComponent.java
// @UserScope
// @Subcomponent(modules = {UserBindingModule.class, AndroidSupportInjectionModule.class})
// public interface UserComponent extends AndroidInjector<DaggerApplication> {
//     void inject(UserManager userManager);
// 
// 
//     @Subcomponent.Builder
//     interface Builder {
// 
//         UserComponent build();
//         @BindsInstance
//         Builder pokeMon(Pokemon pokemon);
//     }
// 
// }


// Path: app/src/main/java/com/ragdroid/dahaka/app/AppComponent.java
import android.app.Application;
import com.ragdroid.dahaka.DahakaApplication;
import com.ragdroid.dahaka.activity.AppBindingModule;
import com.ragdroid.dahaka.api.ApiModule;
import com.ragdroid.dahaka.user.UserComponent;
import javax.inject.Singleton;
import dagger.BindsInstance;
import dagger.Component;
import dagger.android.AndroidInjector;
import dagger.android.DaggerApplication;
import dagger.android.support.AndroidSupportInjectionModule;

package com.ragdroid.dahaka.app;





/**
 * Created by garimajain on 13/08/17.
 */
@Singleton
@Component(modules = {
        AppModule.class,
        ApiModule.class,
        AppBindingModule.class,
        AndroidSupportInjectionModule.class})
public interface AppComponent extends AndroidInjector<DaggerApplication> {


    UserComponent.Builder userBuilder();

    UserManager getUserManager();

    void inject(DahakaApplication instance);

    @Component.Builder
    interface Builder {

        AppComponent build();

        @BindsInstance
        Builder application(Application application);
        Builder apiModule(ApiModule apiModule);