// 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 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;
package com.tonilopezmr.sample.domain.interactor;


/**
 * @author toni.
 */
public class CreateSubjectUseCaseImp extends AbstractSubjectUseCase implements SubjectUseCase {

    private Callback callback;
    private Subject subject;

    public CreateSubjectUseCaseImp(Executor executor, MainThread mainThread, SubjectRepository subjectRepository) {
        super(executor, mainThread, subjectRepository);
    }

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

        this.callback = callback;
        this.subject = subject;
        getExecutor().run(this);
    }


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

        getSubjectRepository().createSubject(subject, new SubjectRepository.SubjectUseCase() {
// 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/CreateSubjectUseCaseImp.java
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;

package com.tonilopezmr.sample.domain.interactor;


/**
 * @author toni.
 */
public class CreateSubjectUseCaseImp extends AbstractSubjectUseCase implements SubjectUseCase {

    private Callback callback;
    private Subject subject;

    public CreateSubjectUseCaseImp(Executor executor, MainThread mainThread, SubjectRepository subjectRepository) {
        super(executor, mainThread, subjectRepository);
    }

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

        this.callback = callback;
        this.subject = subject;
        getExecutor().run(this);
    }


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

        getSubjectRepository().createSubject(subject, new SubjectRepository.SubjectUseCase() {
            @Override