// Path: app/src/main/java/com/tylersuehr/cleanarchitecture/data/models/Person.java
// public class Person extends Entity {
//     private String firstName;
//     private String lastName;
//     private String image;
//     private int age;
// 
// 
//     public Person() {}
// 
//     @Override
//     public String getId() {
//         return (String)super.getId();
//     }
// 
//     public String getFirstName() {
//         return firstName;
//     }
// 
//     public void setFirstName(String firstName) {
//         this.firstName = firstName;
//     }
// 
//     public String getLastName() {
//         return lastName;
//     }
// 
//     public void setLastName(String lastName) {
//         this.lastName = lastName;
//     }
// 
//     public int getAge() {
//         return age;
//     }
// 
//     public void setAge(int age) {
//         this.age = age;
//     }
// 
//     public String getImage() {
//         return image;
//     }
// 
//     public void setImage(String image) {
//         this.image = image;
//     }
// }
// 
// Path: app/src/main/java/com/tylersuehr/cleanarchitecture/data/repositories/Callbacks.java
// public interface Callbacks {
//     /**
//      * Defines an interface for handling an error callback.
//      */
//     interface IError {
//         void onNotAvailable(Exception ex);
//     }
// 
//     /**
//      * Defines an interface for handling a single response callback.
//      */
//     interface ISingle<T extends Entity> extends IError {
//         void onSingleLoaded(T value);
//     }
// 
//     /**
//      * Defines an interface for handling a list response callback.
//      */
//     interface IList<T extends Entity> extends IError {
//         void onListLoaded(List<T> values);
//     }
// }
// 
// Path: app/src/main/java/com/tylersuehr/cleanarchitecture/data/repositories/people/IPersonRepository.java
// public interface IPersonRepository {
//     /**
//      * Creates a new person in the repository.
//      * @param person {@link Person}
//      * @throws Exception if create fails
//      */
//     void createPerson(Person person) throws Exception;
// 
//     /**
//      * Deletes a person in the repository. Leave null to delete all
//      * people in the repository.
//      * @param person {@link Person}
//      *
//      * @throws Exception if deletion fails
//      */
//     void deletePerson(@Nullable Person person) throws Exception;
// 
//     /**
//      * Finds all people in the repository.
//      * @param callback {@link Callbacks.IList}
//      */
//     void findAllPeople(Callbacks.IList<Person> callback);
// 
//     /**
//      * Finds a person in the repository using their profile ID.
//      * @param personId Person's profile ID
//      * @param callback {@link Callbacks.ISingle}
//      */
//     void findPersonById(String personId, Callbacks.ISingle<Person> callback);
// }
// 
// Path: app/src/main/java/com/tylersuehr/cleanarchitecture/domain/UseCase.java
// public abstract class UseCase<Request, Response> {
//     private UseCaseCallback<Response> callback;
//     private Request request;
// 
// 
//     @WorkerThread
//     protected abstract void onExecute();
// 
//     /**
//      * Passes the use case by logging it and invoking the appropriate callback
//      * with the response data from the successful execution.
//      * @param response Response data
//      */
//     protected final void pass(final Response response) {
//         Log.i(getClass().getSimpleName().toUpperCase(), "Success!");
//         this.callback.onSuccess(response);
//     }
// 
//     /**
//      * Fails the use case by logging it and invoking the appropriate callback
//      * containing information about by it fail execution.
//      * @param ex {@link Exception}
//      */
//     protected final void fail(final Exception ex) {
//         Log.wtf(getClass().getSimpleName().toUpperCase(), "Failed!", ex);
//         this.callback.onFailure(ex);
//     }
// 
//     public Request getRequest() {
//         return request;
//     }
// 
//     void setRequest(final Request request) {
//         this.request = request;
//     }
// 
//     void setCallback(final UseCaseCallback<Response> callback) {
//         this.callback = callback;
//     }
// }


import com.tylersuehr.cleanarchitecture.data.models.Person;
import com.tylersuehr.cleanarchitecture.data.repositories.Callbacks;
import com.tylersuehr.cleanarchitecture.data.repositories.people.IPersonRepository;
import com.tylersuehr.cleanarchitecture.domain.UseCase;
package com.tylersuehr.cleanarchitecture.domain.people;

/**
 * Copyright 2017 Tyler Suehr
 *
 * Business logic to find a person in the repository.
 * Request: Person's id.
 * Response: Valid {@link Person}.
 *
 * @author Tyler Suehr
 * @version 1.0
 */
public class FindPersonTask extends UseCase<String, Person> {
    private final IPersonRepository personRepo;


    public FindPersonTask(IPersonRepository personRepo) {
        this.personRepo = personRepo;
    }

    @Override
    protected void onExecute() {
        final String personId = getRequest();
// Path: app/src/main/java/com/tylersuehr/cleanarchitecture/data/models/Person.java
// public class Person extends Entity {
//     private String firstName;
//     private String lastName;
//     private String image;
//     private int age;
// 
// 
//     public Person() {}
// 
//     @Override
//     public String getId() {
//         return (String)super.getId();
//     }
// 
//     public String getFirstName() {
//         return firstName;
//     }
// 
//     public void setFirstName(String firstName) {
//         this.firstName = firstName;
//     }
// 
//     public String getLastName() {
//         return lastName;
//     }
// 
//     public void setLastName(String lastName) {
//         this.lastName = lastName;
//     }
// 
//     public int getAge() {
//         return age;
//     }
// 
//     public void setAge(int age) {
//         this.age = age;
//     }
// 
//     public String getImage() {
//         return image;
//     }
// 
//     public void setImage(String image) {
//         this.image = image;
//     }
// }
// 
// Path: app/src/main/java/com/tylersuehr/cleanarchitecture/data/repositories/Callbacks.java
// public interface Callbacks {
//     /**
//      * Defines an interface for handling an error callback.
//      */
//     interface IError {
//         void onNotAvailable(Exception ex);
//     }
// 
//     /**
//      * Defines an interface for handling a single response callback.
//      */
//     interface ISingle<T extends Entity> extends IError {
//         void onSingleLoaded(T value);
//     }
// 
//     /**
//      * Defines an interface for handling a list response callback.
//      */
//     interface IList<T extends Entity> extends IError {
//         void onListLoaded(List<T> values);
//     }
// }
// 
// Path: app/src/main/java/com/tylersuehr/cleanarchitecture/data/repositories/people/IPersonRepository.java
// public interface IPersonRepository {
//     /**
//      * Creates a new person in the repository.
//      * @param person {@link Person}
//      * @throws Exception if create fails
//      */
//     void createPerson(Person person) throws Exception;
// 
//     /**
//      * Deletes a person in the repository. Leave null to delete all
//      * people in the repository.
//      * @param person {@link Person}
//      *
//      * @throws Exception if deletion fails
//      */
//     void deletePerson(@Nullable Person person) throws Exception;
// 
//     /**
//      * Finds all people in the repository.
//      * @param callback {@link Callbacks.IList}
//      */
//     void findAllPeople(Callbacks.IList<Person> callback);
// 
//     /**
//      * Finds a person in the repository using their profile ID.
//      * @param personId Person's profile ID
//      * @param callback {@link Callbacks.ISingle}
//      */
//     void findPersonById(String personId, Callbacks.ISingle<Person> callback);
// }
// 
// Path: app/src/main/java/com/tylersuehr/cleanarchitecture/domain/UseCase.java
// public abstract class UseCase<Request, Response> {
//     private UseCaseCallback<Response> callback;
//     private Request request;
// 
// 
//     @WorkerThread
//     protected abstract void onExecute();
// 
//     /**
//      * Passes the use case by logging it and invoking the appropriate callback
//      * with the response data from the successful execution.
//      * @param response Response data
//      */
//     protected final void pass(final Response response) {
//         Log.i(getClass().getSimpleName().toUpperCase(), "Success!");
//         this.callback.onSuccess(response);
//     }
// 
//     /**
//      * Fails the use case by logging it and invoking the appropriate callback
//      * containing information about by it fail execution.
//      * @param ex {@link Exception}
//      */
//     protected final void fail(final Exception ex) {
//         Log.wtf(getClass().getSimpleName().toUpperCase(), "Failed!", ex);
//         this.callback.onFailure(ex);
//     }
// 
//     public Request getRequest() {
//         return request;
//     }
// 
//     void setRequest(final Request request) {
//         this.request = request;
//     }
// 
//     void setCallback(final UseCaseCallback<Response> callback) {
//         this.callback = callback;
//     }
// }


// Path: app/src/main/java/com/tylersuehr/cleanarchitecture/domain/people/FindPersonTask.java
import com.tylersuehr.cleanarchitecture.data.models.Person;
import com.tylersuehr.cleanarchitecture.data.repositories.Callbacks;
import com.tylersuehr.cleanarchitecture.data.repositories.people.IPersonRepository;
import com.tylersuehr.cleanarchitecture.domain.UseCase;

package com.tylersuehr.cleanarchitecture.domain.people;

/**
 * Copyright 2017 Tyler Suehr
 *
 * Business logic to find a person in the repository.
 * Request: Person's id.
 * Response: Valid {@link Person}.
 *
 * @author Tyler Suehr
 * @version 1.0
 */
public class FindPersonTask extends UseCase<String, Person> {
    private final IPersonRepository personRepo;


    public FindPersonTask(IPersonRepository personRepo) {
        this.personRepo = personRepo;
    }

    @Override
    protected void onExecute() {
        final String personId = getRequest();
        this.personRepo.findPersonById(personId, new Callbacks.ISingle<Person>() {