// Path: interactorexecutor/src/main/java/com/tonilopezmr/interactorexecutor/Executor.java
// public interface Executor {
//     void run(final Interactor interactor);
// }
// 
// Path: interactorexecutor/src/main/java/com/tonilopezmr/interactorexecutor/MainThread.java
// public interface MainThread {
//     void post(final Runnable runnable);
// }
// 
// Path: app/src/main/java/com/tonilopezmr/sample/domain/Subject.java
// public class Subject {
// 
//     private int id;
//     private String name;
// 
//     public Subject(String name) {
//         this.name = name;
//     }
// 
//     public Subject(int id, String name) {
//         this.id = id;
//         this.name = name;
//     }
// 
//     public int getId() {
//         return id;
//     }
// 
//     public void setId(int id) {
//         this.id = id;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     @Override
//     public String toString() {
//         return "ID: "+this.id+" Subject: "+this.name;
//     }
// }


import android.util.Log;
import com.tonilopezmr.interactorexecutor.Executor;
import com.tonilopezmr.interactorexecutor.MainThread;
import com.tonilopezmr.sample.domain.Subject;
import com.tonilopezmr.sample.domain.exception.SubjectException;
import com.tonilopezmr.sample.domain.repository.SubjectRepository;
import java.util.Collection;
package com.tonilopezmr.sample.domain.interactor;





/**
 * @author toni.
 */
public class GetSubjectListUseCaseImp implements GetSubjectListUseCase{


    private SubjectRepository subjectRepository;
    private Executor executor;
    private MainThread mainThread;

    private Callback callback;

    public GetSubjectListUseCaseImp(Executor executor, MainThread mainThread, SubjectRepository subjectRepository) {
        this.subjectRepository = subjectRepository;
        this.executor = executor;
        this.mainThread = mainThread;
    }

    //Run interactor
    @Override
    public void execute(final Callback callback) {
        if (callback == null) {
            throw new IllegalArgumentException("Callback parameter can't be null");
        }

        this.callback = callback;
        this.executor.run(this);
    }

    //Interactor User case
    @Override
    public void run() {
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        subjectRepository.getSubjectsCollection(new SubjectRepository.SubjectListCallback() {
            @Override
            public void onSubjectListLoader(final Collection<Subject> subjects) {
// Path: interactorexecutor/src/main/java/com/tonilopezmr/interactorexecutor/Executor.java
// public interface Executor {
//     void run(final Interactor interactor);
// }
// 
// Path: interactorexecutor/src/main/java/com/tonilopezmr/interactorexecutor/MainThread.java
// public interface MainThread {
//     void post(final Runnable runnable);
// }
// 
// Path: app/src/main/java/com/tonilopezmr/sample/domain/Subject.java
// public class Subject {
// 
//     private int id;
//     private String name;
// 
//     public Subject(String name) {
//         this.name = name;
//     }
// 
//     public Subject(int id, String name) {
//         this.id = id;
//         this.name = name;
//     }
// 
//     public int getId() {
//         return id;
//     }
// 
//     public void setId(int id) {
//         this.id = id;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     @Override
//     public String toString() {
//         return "ID: "+this.id+" Subject: "+this.name;
//     }
// }


// Path: app/src/main/java/com/tonilopezmr/sample/domain/interactor/GetSubjectListUseCaseImp.java
import android.util.Log;
import com.tonilopezmr.interactorexecutor.Executor;
import com.tonilopezmr.interactorexecutor.MainThread;
import com.tonilopezmr.sample.domain.Subject;
import com.tonilopezmr.sample.domain.exception.SubjectException;
import com.tonilopezmr.sample.domain.repository.SubjectRepository;
import java.util.Collection;

package com.tonilopezmr.sample.domain.interactor;





/**
 * @author toni.
 */
public class GetSubjectListUseCaseImp implements GetSubjectListUseCase{


    private SubjectRepository subjectRepository;
    private Executor executor;
    private MainThread mainThread;

    private Callback callback;

    public GetSubjectListUseCaseImp(Executor executor, MainThread mainThread, SubjectRepository subjectRepository) {
        this.subjectRepository = subjectRepository;
        this.executor = executor;
        this.mainThread = mainThread;
    }

    //Run interactor
    @Override
    public void execute(final Callback callback) {
        if (callback == null) {
            throw new IllegalArgumentException("Callback parameter can't be null");
        }

        this.callback = callback;
        this.executor.run(this);
    }

    //Interactor User case
    @Override
    public void run() {
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        subjectRepository.getSubjectsCollection(new SubjectRepository.SubjectListCallback() {
            @Override
            public void onSubjectListLoader(final Collection<Subject> subjects) {
                mainThread.post(new Runnable() {