// Path: realmrepository/src/main/java/com/github/aleksandermielczarek/realmrepository/configuration/RealmRepositoryConfiguration.java
// public class RealmRepositoryConfiguration {
// 
//     private final RealmProvider realmProvider;
// 
//     private RealmRepositoryConfiguration(Builder builder) {
//         realmProvider = builder.realmProvider;
//     }
// 
//     public static RealmRepositoryConfiguration getDefault() {
//         return builder().build();
//     }
// 
//     public static Builder builder() {
//         return new Builder();
//     }
// 
//     public RealmProvider getRealmProvider() {
//         return realmProvider;
//     }
// 
//     public static class Builder {
// 
//         private RealmProvider realmProvider;
// 
//         private Builder() {
// 
//         }
// 
//         public Builder withRealmProvider(RealmProvider realmProvider) {
//             this.realmProvider = realmProvider;
//             return this;
//         }
// 
//         public RealmRepositoryConfiguration build() {
//             if (realmProvider == null) {
//                 realmProvider = new DefaultRealmProvider();
//             }
//             return new RealmRepositoryConfiguration(this);
//         }
//     }
// 
// }
// 
// Path: app/src/main/java/com/github/aleksandermielczarek/realmrepositoryexample/repository/UserRepository.java
// @RealmRepository(autoGenerateId = true)
// public interface UserRepository extends Repository<User, String> {
// }


import android.content.Context;
import com.github.aleksandermielczarek.napkin.qualifier.AppContext;
import com.github.aleksandermielczarek.napkin.scope.AppScope;
import com.github.aleksandermielczarek.realmrepository.configuration.RealmRepositoryConfiguration;
import com.github.aleksandermielczarek.realmrepositoryexample.repository.UserRepository;
import com.github.aleksandermielczarek.realmrepositoryexample.repository.UserRepositoryImpl;
import dagger.Module;
import dagger.Provides;
import io.realm.Realm;
import io.realm.RealmConfiguration;
package com.github.aleksandermielczarek.realmrepositoryexample.module;




/**
 * Created by Aleksander Mielczarek on 22.09.2016.
 */
@Module
@AppScope
public class MainModule {

    @Provides
    @AppScope
    RealmConfiguration provideRealmConfiguration(@AppContext Context context) {
        Realm.init(context);
        return new RealmConfiguration.Builder()
                .deleteRealmIfMigrationNeeded()
                .build();
    }

    @Provides
    @AppScope
    RealmRepositoryConfiguration provideRepositoryConfiguration() {
        return RealmRepositoryConfiguration.getDefault();
    }

    @Provides
    @AppScope
// Path: realmrepository/src/main/java/com/github/aleksandermielczarek/realmrepository/configuration/RealmRepositoryConfiguration.java
// public class RealmRepositoryConfiguration {
// 
//     private final RealmProvider realmProvider;
// 
//     private RealmRepositoryConfiguration(Builder builder) {
//         realmProvider = builder.realmProvider;
//     }
// 
//     public static RealmRepositoryConfiguration getDefault() {
//         return builder().build();
//     }
// 
//     public static Builder builder() {
//         return new Builder();
//     }
// 
//     public RealmProvider getRealmProvider() {
//         return realmProvider;
//     }
// 
//     public static class Builder {
// 
//         private RealmProvider realmProvider;
// 
//         private Builder() {
// 
//         }
// 
//         public Builder withRealmProvider(RealmProvider realmProvider) {
//             this.realmProvider = realmProvider;
//             return this;
//         }
// 
//         public RealmRepositoryConfiguration build() {
//             if (realmProvider == null) {
//                 realmProvider = new DefaultRealmProvider();
//             }
//             return new RealmRepositoryConfiguration(this);
//         }
//     }
// 
// }
// 
// Path: app/src/main/java/com/github/aleksandermielczarek/realmrepositoryexample/repository/UserRepository.java
// @RealmRepository(autoGenerateId = true)
// public interface UserRepository extends Repository<User, String> {
// }


// Path: app/src/main/java/com/github/aleksandermielczarek/realmrepositoryexample/module/MainModule.java
import android.content.Context;
import com.github.aleksandermielczarek.napkin.qualifier.AppContext;
import com.github.aleksandermielczarek.napkin.scope.AppScope;
import com.github.aleksandermielczarek.realmrepository.configuration.RealmRepositoryConfiguration;
import com.github.aleksandermielczarek.realmrepositoryexample.repository.UserRepository;
import com.github.aleksandermielczarek.realmrepositoryexample.repository.UserRepositoryImpl;
import dagger.Module;
import dagger.Provides;
import io.realm.Realm;
import io.realm.RealmConfiguration;

package com.github.aleksandermielczarek.realmrepositoryexample.module;




/**
 * Created by Aleksander Mielczarek on 22.09.2016.
 */
@Module
@AppScope
public class MainModule {

    @Provides
    @AppScope
    RealmConfiguration provideRealmConfiguration(@AppContext Context context) {
        Realm.init(context);
        return new RealmConfiguration.Builder()
                .deleteRealmIfMigrationNeeded()
                .build();
    }

    @Provides
    @AppScope
    RealmRepositoryConfiguration provideRepositoryConfiguration() {
        return RealmRepositoryConfiguration.getDefault();
    }

    @Provides
    @AppScope
    UserRepository provideUserRepository(RealmRepositoryConfiguration repositoryConfiguration) {