// Path: app/src/main/java/io/petros/posts/service/retrofit/RetrofitService.java
// public interface RetrofitService {
// 
//     @GET("/posts")
//     Observable<List<Post>> posts();
// 
//     @GET("/users")
//     Observable<List<User>> users();
// 
//     @GET("/comments")
//     Observable<List<Comment>> comments(@Query("postId") int postId);
// 
// }
// 
// Path: app/src/main/java/io/petros/posts/util/rx/RxSchedulers.java
// public class RxSchedulers {
// 
//     /**
//      * A {@link Scheduler} intended for IO-bound work. The implementation is backed by an {@link java.util.concurrent.Executor}
//      * thread-pool that will grow as needed. This can be used for asynchronously performing blocking IO.
//      */
//     private final Scheduler ioScheduler;
// 
//     /**
//      * A {@link Scheduler} intended for computational work. This can be used for event-loops, processing callbacks and other
//      * computational work. Unhandled errors will be delivered to the scheduler Thread's {@link Thread.UncaughtExceptionHandler}.
//      **/
//     private final Scheduler computationScheduler;
// 
//     /**
//      * A {@link Scheduler} that queues work on the current thread to be executed after the current work completes.
//      */
//     private final Scheduler trampolineScheduler;
// 
//     /**
//      * A {@link Scheduler} which executes actions on the Android UI thread.
//      */
//     private final Scheduler androidMainThreadScheduler;
// 
//     public RxSchedulers(final Scheduler ioScheduler, final Scheduler computationScheduler, final Scheduler trampolineScheduler,
//                         final Scheduler androidMainThreadScheduler) {
//         this.ioScheduler = ioScheduler;
//         this.computationScheduler = computationScheduler;
//         this.trampolineScheduler = trampolineScheduler;
//         this.androidMainThreadScheduler = androidMainThreadScheduler;
//     }
// 
//     public Scheduler getIoScheduler() {
//         return ioScheduler;
//     }
// 
//     public Scheduler getComputationScheduler() {
//         return computationScheduler;
//     }
// 
//     public Scheduler getTrampolineScheduler() {
//         return trampolineScheduler;
//     }
// 
//     public Scheduler getAndroidMainThreadScheduler() {
//         return androidMainThreadScheduler;
//     }
// 
// }


import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
import io.petros.posts.service.retrofit.RetrofitService;
import io.petros.posts.util.rx.RxSchedulers;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
package io.petros.posts.app.graph.modules;



@Module
public class NetModule {

    private final String baseUrl;

    public NetModule(final String baseUrl) {
        this.baseUrl = baseUrl;
    }

    @Provides
    @Singleton
    RxSchedulers providesRxSchedulers() {
        return new RxSchedulers(Schedulers.io(), Schedulers.computation(), Schedulers.trampoline(),
                AndroidSchedulers.mainThread());
    }

    @Provides
    @Singleton
    RetrofitService provideRetroService() {
        final Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(baseUrl)
                .addConverterFactory(GsonConverterFactory.create())
                .addCallAdapterFactory(RxJava2CallAdapterFactory.create()).build();
// Path: app/src/main/java/io/petros/posts/service/retrofit/RetrofitService.java
// public interface RetrofitService {
// 
//     @GET("/posts")
//     Observable<List<Post>> posts();
// 
//     @GET("/users")
//     Observable<List<User>> users();
// 
//     @GET("/comments")
//     Observable<List<Comment>> comments(@Query("postId") int postId);
// 
// }
// 
// Path: app/src/main/java/io/petros/posts/util/rx/RxSchedulers.java
// public class RxSchedulers {
// 
//     /**
//      * A {@link Scheduler} intended for IO-bound work. The implementation is backed by an {@link java.util.concurrent.Executor}
//      * thread-pool that will grow as needed. This can be used for asynchronously performing blocking IO.
//      */
//     private final Scheduler ioScheduler;
// 
//     /**
//      * A {@link Scheduler} intended for computational work. This can be used for event-loops, processing callbacks and other
//      * computational work. Unhandled errors will be delivered to the scheduler Thread's {@link Thread.UncaughtExceptionHandler}.
//      **/
//     private final Scheduler computationScheduler;
// 
//     /**
//      * A {@link Scheduler} that queues work on the current thread to be executed after the current work completes.
//      */
//     private final Scheduler trampolineScheduler;
// 
//     /**
//      * A {@link Scheduler} which executes actions on the Android UI thread.
//      */
//     private final Scheduler androidMainThreadScheduler;
// 
//     public RxSchedulers(final Scheduler ioScheduler, final Scheduler computationScheduler, final Scheduler trampolineScheduler,
//                         final Scheduler androidMainThreadScheduler) {
//         this.ioScheduler = ioScheduler;
//         this.computationScheduler = computationScheduler;
//         this.trampolineScheduler = trampolineScheduler;
//         this.androidMainThreadScheduler = androidMainThreadScheduler;
//     }
// 
//     public Scheduler getIoScheduler() {
//         return ioScheduler;
//     }
// 
//     public Scheduler getComputationScheduler() {
//         return computationScheduler;
//     }
// 
//     public Scheduler getTrampolineScheduler() {
//         return trampolineScheduler;
//     }
// 
//     public Scheduler getAndroidMainThreadScheduler() {
//         return androidMainThreadScheduler;
//     }
// 
// }


// Path: app/src/main/java/io/petros/posts/app/graph/modules/NetModule.java
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
import io.petros.posts.service.retrofit.RetrofitService;
import io.petros.posts.util.rx.RxSchedulers;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

package io.petros.posts.app.graph.modules;



@Module
public class NetModule {

    private final String baseUrl;

    public NetModule(final String baseUrl) {
        this.baseUrl = baseUrl;
    }

    @Provides
    @Singleton
    RxSchedulers providesRxSchedulers() {
        return new RxSchedulers(Schedulers.io(), Schedulers.computation(), Schedulers.trampoline(),
                AndroidSchedulers.mainThread());
    }

    @Provides
    @Singleton
    RetrofitService provideRetroService() {
        final Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(baseUrl)
                .addConverterFactory(GsonConverterFactory.create())
                .addCallAdapterFactory(RxJava2CallAdapterFactory.create()).build();
        return retrofit.create(RetrofitService.class);