// 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);
//     }
// }


import com.tylersuehr.cleanarchitecture.data.models.Person;
import com.tylersuehr.cleanarchitecture.data.repositories.Callbacks;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
    private PersonRepository(IPersonRepository local) {
        this.local = local;
    }

    public static PersonRepository getInstance(IPersonRepository local) {
        if (instance == null) {
            synchronized (PersonRepository.class) {
                if (instance == null) {
                    instance = new PersonRepository(local);
                }
            }
        }
        return instance;
    }

    @Override
    public void createPerson(Person person) throws Exception {
        this.local.createPerson(person);
        addToCache(person);
    }

    @Override
    public void deletePerson(Person person) throws Exception {
        this.local.deletePerson(person);
        if (cache != null && person != null) {
            this.cache.remove(person.getId());
        }
    }

    @Override
// 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/PersonRepository.java
import com.tylersuehr.cleanarchitecture.data.models.Person;
import com.tylersuehr.cleanarchitecture.data.repositories.Callbacks;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

    private PersonRepository(IPersonRepository local) {
        this.local = local;
    }

    public static PersonRepository getInstance(IPersonRepository local) {
        if (instance == null) {
            synchronized (PersonRepository.class) {
                if (instance == null) {
                    instance = new PersonRepository(local);
                }
            }
        }
        return instance;
    }

    @Override
    public void createPerson(Person person) throws Exception {
        this.local.createPerson(person);
        addToCache(person);
    }

    @Override
    public void deletePerson(Person person) throws Exception {
        this.local.deletePerson(person);
        if (cache != null && person != null) {
            this.cache.remove(person.getId());
        }
    }

    @Override
    public void findAllPeople(final Callbacks.IList<Person> callback) {