// Path: app/src/main/java/com/jonathanpetitfrere/mvvm/MvvmApplication.java
// public class MvvmApplication extends Application {
// 
//     protected AppGraph component;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         if (LeakCanary.isInAnalyzerProcess(this)) {
//             // This process is dedicated to LeakCanary for heap analysis.
//             // You should not init your app in this process.
//             return;
//         }
// 
//         LeakCanary.install(this);
//         Stetho.initializeWithDefaults(this);
// 
//         if(BuildConfig.DEBUG) {
//             Timber.plant(new Timber.DebugTree());
//             Timber.plant(new StethoTree());
//         }
// 
//         component = DaggerApplicationComponent.builder()
//                 .applicationModule(new ApplicationModule(this))
//                 .build();
// 
//         component.inject(this);
//     }
// 
//     public AppGraph getComponent() {
//         return component;
//     }
// }
// 
// Path: app/src/main/java/com/jonathanpetitfrere/mvvm/ui/main/MainViewModel.java
// public class MainViewModel extends BaseAndroidViewModel {
// 
//     @Inject
//     UserRepository userRepository;
// 
//     private MutableLiveData<String> emailLiveData = new MutableLiveData<>();
// 
//     private MutableLiveData<String> firstNameLiveData = new MutableLiveData<>();
// 
//     private MutableLiveData<String> lastNameLiveData = new MutableLiveData<>();
// 
//     private MutableLiveData<Boolean> validInputLiveData = new MutableLiveData<>();
// 
//     public MainViewModel(Application application) {
//         super(application);
//         getMvvmApplication().getComponent().inject(this);
//     }
// 
//     public LiveData<Boolean> createUser() {
//         User user = new User(emailLiveData.getValue(), firstNameLiveData.getValue(), lastNameLiveData.getValue());
//         return userRepository.saveUser(user);
//     }
// 
//     public LiveData<User> getUser(String email) {
//         return userRepository.getUser(email);
//     }
// 
//     public LiveData<List<User>> getUsers() {
//         return userRepository.getUsers();
//     }
// 
//     public LiveData<Boolean> validInput() {
//         //default value
//         if(validInputLiveData.getValue() == null) {
//             validInputLiveData.setValue(false);
//         }
// 
//         return validInputLiveData;
//     }
// 
//     public void setEmail(String email) {
//         emailLiveData.setValue(email);
//         validateInput();
//     }
// 
//     public void setFirstName(String firstName) {
//         firstNameLiveData.setValue(firstName);
//         validateInput();
//     }
// 
//     public void setLastName(String lastName) {
//         lastNameLiveData.setValue(lastName);
//         validateInput();
//     }
// 
//     private void validateInput() {
//         String email = emailLiveData.getValue();
//         String firstName = firstNameLiveData.getValue();
//         String lastName = lastNameLiveData.getValue();
// 
//         boolean validInput = (email != null && !email.isEmpty())
//                 && (firstName != null && !firstName.isEmpty())
//                 && (lastName != null && !lastName.isEmpty());
// 
//         validInputLiveData.setValue(validInput);
//     }
// 
// }


import com.jonathanpetitfrere.mvvm.MvvmApplication;
import com.jonathanpetitfrere.mvvm.ui.main.MainViewModel;
package com.jonathanpetitfrere.mvvm.di;


/**
 * This interface provides methods for all of the Dagger injection targets in the app. Making it
 * a separate interface allows normal and test components to access these methods.
 *
 * @author jpetit
 */
public interface AppGraph {
    //Application
    void inject(MvvmApplication mvvmApplication);

    //View Model
// Path: app/src/main/java/com/jonathanpetitfrere/mvvm/MvvmApplication.java
// public class MvvmApplication extends Application {
// 
//     protected AppGraph component;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         if (LeakCanary.isInAnalyzerProcess(this)) {
//             // This process is dedicated to LeakCanary for heap analysis.
//             // You should not init your app in this process.
//             return;
//         }
// 
//         LeakCanary.install(this);
//         Stetho.initializeWithDefaults(this);
// 
//         if(BuildConfig.DEBUG) {
//             Timber.plant(new Timber.DebugTree());
//             Timber.plant(new StethoTree());
//         }
// 
//         component = DaggerApplicationComponent.builder()
//                 .applicationModule(new ApplicationModule(this))
//                 .build();
// 
//         component.inject(this);
//     }
// 
//     public AppGraph getComponent() {
//         return component;
//     }
// }
// 
// Path: app/src/main/java/com/jonathanpetitfrere/mvvm/ui/main/MainViewModel.java
// public class MainViewModel extends BaseAndroidViewModel {
// 
//     @Inject
//     UserRepository userRepository;
// 
//     private MutableLiveData<String> emailLiveData = new MutableLiveData<>();
// 
//     private MutableLiveData<String> firstNameLiveData = new MutableLiveData<>();
// 
//     private MutableLiveData<String> lastNameLiveData = new MutableLiveData<>();
// 
//     private MutableLiveData<Boolean> validInputLiveData = new MutableLiveData<>();
// 
//     public MainViewModel(Application application) {
//         super(application);
//         getMvvmApplication().getComponent().inject(this);
//     }
// 
//     public LiveData<Boolean> createUser() {
//         User user = new User(emailLiveData.getValue(), firstNameLiveData.getValue(), lastNameLiveData.getValue());
//         return userRepository.saveUser(user);
//     }
// 
//     public LiveData<User> getUser(String email) {
//         return userRepository.getUser(email);
//     }
// 
//     public LiveData<List<User>> getUsers() {
//         return userRepository.getUsers();
//     }
// 
//     public LiveData<Boolean> validInput() {
//         //default value
//         if(validInputLiveData.getValue() == null) {
//             validInputLiveData.setValue(false);
//         }
// 
//         return validInputLiveData;
//     }
// 
//     public void setEmail(String email) {
//         emailLiveData.setValue(email);
//         validateInput();
//     }
// 
//     public void setFirstName(String firstName) {
//         firstNameLiveData.setValue(firstName);
//         validateInput();
//     }
// 
//     public void setLastName(String lastName) {
//         lastNameLiveData.setValue(lastName);
//         validateInput();
//     }
// 
//     private void validateInput() {
//         String email = emailLiveData.getValue();
//         String firstName = firstNameLiveData.getValue();
//         String lastName = lastNameLiveData.getValue();
// 
//         boolean validInput = (email != null && !email.isEmpty())
//                 && (firstName != null && !firstName.isEmpty())
//                 && (lastName != null && !lastName.isEmpty());
// 
//         validInputLiveData.setValue(validInput);
//     }
// 
// }


// Path: app/src/main/java/com/jonathanpetitfrere/mvvm/di/AppGraph.java
import com.jonathanpetitfrere.mvvm.MvvmApplication;
import com.jonathanpetitfrere.mvvm.ui.main.MainViewModel;

package com.jonathanpetitfrere.mvvm.di;


/**
 * This interface provides methods for all of the Dagger injection targets in the app. Making it
 * a separate interface allows normal and test components to access these methods.
 *
 * @author jpetit
 */
public interface AppGraph {
    //Application
    void inject(MvvmApplication mvvmApplication);

    //View Model
    void inject(MainViewModel mainViewModel);