// Path: app/src/mock/java/br/ufs/demos/rxmvp/playground/fakes/FakeWebService.java
// public class FakeWebService implements NumbersWebService {
// 
//     public enum NextCall {
//         UNDEFINED_ERROR,
//         CONNECTION_ERROR,
//         CONNECTION_TIMEOUT,
//         INTERNAL_SERVER_ERROR_5xy,
//         NOT_FOUND_404,
//         SUCCESS_200
//     }
// 
//     private NextCall nextReturn;
// 
// 
//     public FakeWebService() {
//         nextReturn = NextCall.UNDEFINED_ERROR;
//     }
// 
//     public void nextCallPerform(NextCall nextReturn) {
//         this.nextReturn = nextReturn;
//     }
// 
//     @Override public Flowable<NumbersTriviaPayload> getTrivia(String commaSeparatedNumbers) {
// 
//         switch (nextReturn) {
//             case SUCCESS_200:
//                 return FakeResponses.triviaResults();
// 
//             case NOT_FOUND_404:
//                 return FakeResponses.notFound();
// 
//             case INTERNAL_SERVER_ERROR_5xy:
//                 return FakeResponses.internalServerError();
// 
//             case CONNECTION_ERROR:
//                 return FakeResponses.connectionIssue();
// 
//             case CONNECTION_TIMEOUT:
//                 return FakeResponses.requestTimeout();
//         }
// 
//         return Flowable.empty();
//     }
// 
// }
// 
// Path: app/src/mock/java/br/ufs/demos/rxmvp/playground/fakes/FakeWebService.java
// public enum NextCall {
//     UNDEFINED_ERROR,
//     CONNECTION_ERROR,
//     CONNECTION_TIMEOUT,
//     INTERNAL_SERVER_ERROR_5xy,
//     NOT_FOUND_404,
//     SUCCESS_200
// }
// 
// Path: app/src/main/java/br/ufs/demos/rxmvp/playground/webservice/NumbersWebService.java
// public interface NumbersWebService {
// 
//     String BASE_URL = "http://numbersapi.com";
// 
//     @GET("/{numbers}/trivia") Flowable<NumbersTriviaPayload> getTrivia(
//             @Path("numbers") String commaSeparatedNumbers
//     );
// 
// }


import android.app.Activity;
import android.app.Application;
import javax.inject.Inject;
import br.ufs.demos.rxmvp.playground.dagger.components.DaggerAppComponent;
import br.ufs.demos.rxmvp.playground.fakes.FakeWebService;
import br.ufs.demos.rxmvp.playground.fakes.FakeWebService.NextCall;
import br.ufs.demos.rxmvp.playground.webservice.NumbersWebService;
import dagger.android.DispatchingAndroidInjector;
import dagger.android.HasActivityInjector;
package br.ufs.demos.rxmvp.playground.app;




/**
 * Created by bira on 6/26/17.
 */

public class MainApplication extends Application implements HasActivityInjector {

    @Inject DispatchingAndroidInjector<Activity> injector;
    @Inject public NumbersWebService webservice;

    @Override public void onCreate() {
        super.onCreate();
        buildTopLevelDependenciesGraph();
        setupMock();
    }

    @Override public DispatchingAndroidInjector<Activity> activityInjector() {
        return injector;
    }

    protected void buildTopLevelDependenciesGraph() {
        DaggerAppComponent.builder().application(this).build().inject(this);
    }

    private void setupMock() {
// Path: app/src/mock/java/br/ufs/demos/rxmvp/playground/fakes/FakeWebService.java
// public class FakeWebService implements NumbersWebService {
// 
//     public enum NextCall {
//         UNDEFINED_ERROR,
//         CONNECTION_ERROR,
//         CONNECTION_TIMEOUT,
//         INTERNAL_SERVER_ERROR_5xy,
//         NOT_FOUND_404,
//         SUCCESS_200
//     }
// 
//     private NextCall nextReturn;
// 
// 
//     public FakeWebService() {
//         nextReturn = NextCall.UNDEFINED_ERROR;
//     }
// 
//     public void nextCallPerform(NextCall nextReturn) {
//         this.nextReturn = nextReturn;
//     }
// 
//     @Override public Flowable<NumbersTriviaPayload> getTrivia(String commaSeparatedNumbers) {
// 
//         switch (nextReturn) {
//             case SUCCESS_200:
//                 return FakeResponses.triviaResults();
// 
//             case NOT_FOUND_404:
//                 return FakeResponses.notFound();
// 
//             case INTERNAL_SERVER_ERROR_5xy:
//                 return FakeResponses.internalServerError();
// 
//             case CONNECTION_ERROR:
//                 return FakeResponses.connectionIssue();
// 
//             case CONNECTION_TIMEOUT:
//                 return FakeResponses.requestTimeout();
//         }
// 
//         return Flowable.empty();
//     }
// 
// }
// 
// Path: app/src/mock/java/br/ufs/demos/rxmvp/playground/fakes/FakeWebService.java
// public enum NextCall {
//     UNDEFINED_ERROR,
//     CONNECTION_ERROR,
//     CONNECTION_TIMEOUT,
//     INTERNAL_SERVER_ERROR_5xy,
//     NOT_FOUND_404,
//     SUCCESS_200
// }
// 
// Path: app/src/main/java/br/ufs/demos/rxmvp/playground/webservice/NumbersWebService.java
// public interface NumbersWebService {
// 
//     String BASE_URL = "http://numbersapi.com";
// 
//     @GET("/{numbers}/trivia") Flowable<NumbersTriviaPayload> getTrivia(
//             @Path("numbers") String commaSeparatedNumbers
//     );
// 
// }


// Path: app/src/mock/java/br/ufs/demos/rxmvp/playground/app/MainApplication.java
import android.app.Activity;
import android.app.Application;
import javax.inject.Inject;
import br.ufs.demos.rxmvp.playground.dagger.components.DaggerAppComponent;
import br.ufs.demos.rxmvp.playground.fakes.FakeWebService;
import br.ufs.demos.rxmvp.playground.fakes.FakeWebService.NextCall;
import br.ufs.demos.rxmvp.playground.webservice.NumbersWebService;
import dagger.android.DispatchingAndroidInjector;
import dagger.android.HasActivityInjector;

package br.ufs.demos.rxmvp.playground.app;




/**
 * Created by bira on 6/26/17.
 */

public class MainApplication extends Application implements HasActivityInjector {

    @Inject DispatchingAndroidInjector<Activity> injector;
    @Inject public NumbersWebService webservice;

    @Override public void onCreate() {
        super.onCreate();
        buildTopLevelDependenciesGraph();
        setupMock();
    }

    @Override public DispatchingAndroidInjector<Activity> activityInjector() {
        return injector;
    }

    protected void buildTopLevelDependenciesGraph() {
        DaggerAppComponent.builder().application(this).build().inject(this);
    }

    private void setupMock() {
        FakeWebService service = (FakeWebService) webservice;