// Path: domain/src/main/java/com/smassive/daggerworkshopgdg/domain/bean/ComicBo.java
// @Data
// public class ComicBo {
// 
//     private int id;
// 
//     private String title;
// 
//     private String description;
// 
//     private int pageCount;
// 
//     private String thumbnailUrl;
// 
//     private List<String> imageUrls;
// }
// 
// Path: domain/src/main/java/com/smassive/daggerworkshopgdg/domain/exception/ErrorBundle.java
// public interface ErrorBundle {
//   Exception getException();
// 
//   String getErrorMessage();
// }
// 
// Path: domain/src/main/java/com/smassive/daggerworkshopgdg/domain/executor/PostExecutionThread.java
// public interface PostExecutionThread {
//   /**
//    * Causes the {@link Runnable} to be added to the message queue of the Main UI Thread
//    * of the application.
//    *
//    * @param runnable {@link Runnable} to be executed.
//    */
//   void post(Runnable runnable);
// }
// 
// Path: domain/src/main/java/com/smassive/daggerworkshopgdg/domain/executor/ThreadExecutor.java
// public interface ThreadExecutor {
//   /**
//    * Executes a {@link Runnable}.
//    *
//    * @param runnable The class that implements {@link Runnable} interface.
//    */
//   void execute(final Runnable runnable);
// }
// 
// Path: domain/src/main/java/com/smassive/daggerworkshopgdg/domain/repository/ComicsRepository.java
// public interface ComicsRepository {
// 
//     /**
//      * Callback used to be notified when either a comic list has been loaded or an error happened.
//      */
//     interface ComicListCallback {
//         void onComicListLoaded(Collection<ComicBo> comicBoCollection);
// 
//         void onError(ErrorBundle errorBundle);
//     }
// 
//     /**
//      * Callback used to be notified when either a comic has been loaded or an error happened.
//      */
//     interface ComicDetailCallback {
//         void onComicLoaded(ComicBo comic);
// 
//         void onError(ErrorBundle errorBundle);
//     }
// 
//     /**
//      * Get a collection of {@link ComicBo}.
//      *
//      * @param characterId int character identifier which we want to retrieve comics from.
//      * @param refresh boolean true if the request should be done to the cloud.
//      * @param comicListCallback a {@link ComicListCallback} to return info to presentation.
//      */
//     void getComics(int characterId, boolean refresh, ComicListCallback comicListCallback);
// 
//     /**
//      * Get a {@link ComicBo} by id.
//      *
//      * @param comicId int comic identifier which we want to retrieve information.
//      * @param comicDetailCallback a {@link ComicDetailCallback} to return info to presentation.
//      */
//     void getComic(int comicId, ComicDetailCallback comicDetailCallback);
// }


import com.smassive.daggerworkshopgdg.domain.bean.ComicBo;
import com.smassive.daggerworkshopgdg.domain.exception.ErrorBundle;
import com.smassive.daggerworkshopgdg.domain.executor.PostExecutionThread;
import com.smassive.daggerworkshopgdg.domain.executor.ThreadExecutor;
import com.smassive.daggerworkshopgdg.domain.repository.ComicsRepository;
import java.util.Collection;
import javax.inject.Inject;

    private Callback callback;

    @Inject
    public GetComicsUseCaseImpl(ThreadExecutor threadExecutor, PostExecutionThread postExecutionThread,
            ComicsRepository comicsRepository) {
        this.threadExecutor = threadExecutor;
        this.postExecutionThread = postExecutionThread;
        this.comicsRepository = comicsRepository;
    }

    @Override
    public void execute(int characterId, boolean refresh, Callback callback) {
        if (characterId < 0 && callback == null) {
            throw new IllegalArgumentException("Invalid parameters!!!");
        }
        this.characterId = characterId;
        this.refresh = refresh;
        this.callback = callback;
        this.threadExecutor.execute(this);
    }

    @Override
    public void run() {
        this.comicsRepository.getComics(characterId, refresh, repositoryCallback);
    }

    private final ComicsRepository.ComicListCallback repositoryCallback = new ComicsRepository.ComicListCallback() {
        @Override
        public void onComicListLoaded(Collection<ComicBo> comicBoCollection) {
// Path: domain/src/main/java/com/smassive/daggerworkshopgdg/domain/bean/ComicBo.java
// @Data
// public class ComicBo {
// 
//     private int id;
// 
//     private String title;
// 
//     private String description;
// 
//     private int pageCount;
// 
//     private String thumbnailUrl;
// 
//     private List<String> imageUrls;
// }
// 
// Path: domain/src/main/java/com/smassive/daggerworkshopgdg/domain/exception/ErrorBundle.java
// public interface ErrorBundle {
//   Exception getException();
// 
//   String getErrorMessage();
// }
// 
// Path: domain/src/main/java/com/smassive/daggerworkshopgdg/domain/executor/PostExecutionThread.java
// public interface PostExecutionThread {
//   /**
//    * Causes the {@link Runnable} to be added to the message queue of the Main UI Thread
//    * of the application.
//    *
//    * @param runnable {@link Runnable} to be executed.
//    */
//   void post(Runnable runnable);
// }
// 
// Path: domain/src/main/java/com/smassive/daggerworkshopgdg/domain/executor/ThreadExecutor.java
// public interface ThreadExecutor {
//   /**
//    * Executes a {@link Runnable}.
//    *
//    * @param runnable The class that implements {@link Runnable} interface.
//    */
//   void execute(final Runnable runnable);
// }
// 
// Path: domain/src/main/java/com/smassive/daggerworkshopgdg/domain/repository/ComicsRepository.java
// public interface ComicsRepository {
// 
//     /**
//      * Callback used to be notified when either a comic list has been loaded or an error happened.
//      */
//     interface ComicListCallback {
//         void onComicListLoaded(Collection<ComicBo> comicBoCollection);
// 
//         void onError(ErrorBundle errorBundle);
//     }
// 
//     /**
//      * Callback used to be notified when either a comic has been loaded or an error happened.
//      */
//     interface ComicDetailCallback {
//         void onComicLoaded(ComicBo comic);
// 
//         void onError(ErrorBundle errorBundle);
//     }
// 
//     /**
//      * Get a collection of {@link ComicBo}.
//      *
//      * @param characterId int character identifier which we want to retrieve comics from.
//      * @param refresh boolean true if the request should be done to the cloud.
//      * @param comicListCallback a {@link ComicListCallback} to return info to presentation.
//      */
//     void getComics(int characterId, boolean refresh, ComicListCallback comicListCallback);
// 
//     /**
//      * Get a {@link ComicBo} by id.
//      *
//      * @param comicId int comic identifier which we want to retrieve information.
//      * @param comicDetailCallback a {@link ComicDetailCallback} to return info to presentation.
//      */
//     void getComic(int comicId, ComicDetailCallback comicDetailCallback);
// }


// Path: domain/src/main/java/com/smassive/daggerworkshopgdg/domain/interactor/GetComicsUseCaseImpl.java
import com.smassive.daggerworkshopgdg.domain.bean.ComicBo;
import com.smassive.daggerworkshopgdg.domain.exception.ErrorBundle;
import com.smassive.daggerworkshopgdg.domain.executor.PostExecutionThread;
import com.smassive.daggerworkshopgdg.domain.executor.ThreadExecutor;
import com.smassive.daggerworkshopgdg.domain.repository.ComicsRepository;
import java.util.Collection;
import javax.inject.Inject;


    private Callback callback;

    @Inject
    public GetComicsUseCaseImpl(ThreadExecutor threadExecutor, PostExecutionThread postExecutionThread,
            ComicsRepository comicsRepository) {
        this.threadExecutor = threadExecutor;
        this.postExecutionThread = postExecutionThread;
        this.comicsRepository = comicsRepository;
    }

    @Override
    public void execute(int characterId, boolean refresh, Callback callback) {
        if (characterId < 0 && callback == null) {
            throw new IllegalArgumentException("Invalid parameters!!!");
        }
        this.characterId = characterId;
        this.refresh = refresh;
        this.callback = callback;
        this.threadExecutor.execute(this);
    }

    @Override
    public void run() {
        this.comicsRepository.getComics(characterId, refresh, repositoryCallback);
    }

    private final ComicsRepository.ComicListCallback repositoryCallback = new ComicsRepository.ComicListCallback() {
        @Override
        public void onComicListLoaded(Collection<ComicBo> comicBoCollection) {
            notifyGetComicListSuccessfully(comicBoCollection);