// Path: databoundary/src/main/java/eu/rampsoftware/er/data/CurrencyData.java
// public class CurrencyData {
//     private final String mBaseCurrency;
//     private Date mDate;
//     private Map<String, Double> mCurrencies;
// 
//     public CurrencyData(final Date date, final Map<String, Double> currencies, final String baseCurrency) {
//         mDate = date;
//         mCurrencies = currencies;
//         mBaseCurrency = baseCurrency;
//     }
// 
//     public String getBaseCurrency() {
//         return mBaseCurrency;
//     }
// 
//     public Date getDate() {
//         return mDate;
//     }
// 
//     public Map<String, Double> getCurrencies() {
//         return mCurrencies;
//     }
// }
// 
// Path: databoundary/src/main/java/eu/rampsoftware/er/data/CurrencyRepository.java
// public interface CurrencyRepository {
// 
//     Observable<CurrencyData> getCurrencies(final Date date);
// 
//     Observable<SingleValue> getSeries(Date from, Date to, String currencyCode);
// }
// 
// Path: databoundary/src/main/java/eu/rampsoftware/er/data/PreferencesData.java
// public interface PreferencesData {
//     void setCurrenciesExchangeDate(Date date);
//     Optional<Date> getCurrenciesExchangeDate();
// }
// 
// Path: domain/src/main/java/eu/rampsoftware/er/domain/QueryUseCase.java
// public abstract class QueryUseCase<R, T> {
// 
//     private final Scheduler mWorkScheduler;
//     private final Scheduler mObserveScheduler;
// 
//     protected QueryUseCase(Scheduler workScheduler, Scheduler observeScheduler) {
//         this.mWorkScheduler = workScheduler;
//         this.mObserveScheduler = observeScheduler;
//     }
// 
//     public Observable<R> run(T params) {
//         final Observable<R> observable = this.buildUseCaseObservable(params)
//                 .subscribeOn(mWorkScheduler)
//                 .observeOn(mObserveScheduler);
//         return observable;
//     }
// 
//     protected abstract Observable<R> buildUseCaseObservable(final T params);
// 
// 
// }


import java.util.Date;
import eu.rampsoftware.er.data.CurrencyData;
import eu.rampsoftware.er.data.CurrencyRepository;
import eu.rampsoftware.er.data.PreferencesData;
import eu.rampsoftware.er.domain.QueryUseCase;
import io.reactivex.Observable;
import io.reactivex.Scheduler;
import static com.fernandocejas.arrow.checks.Preconditions.checkNotNull;
package eu.rampsoftware.er.domain.usecases;




public class GetCurrenciesUseCase extends QueryUseCase<CurrencyData, GetCurrenciesUseCase.CurrenciesParam> {

    private final CurrencyRepository mRepository;
    private final PreferencesData mPreferences;

    public GetCurrenciesUseCase(final Scheduler workScheduler,
                                final Scheduler observeScheduler,
                                CurrencyRepository repository,
                                PreferencesData preferencesData) {
        super(workScheduler, observeScheduler);
        mRepository = repository;
        mPreferences = preferencesData;
    }

    @Override
    protected Observable<CurrencyData> buildUseCaseObservable(final CurrenciesParam params) {
        mPreferences.setCurrenciesExchangeDate(params.date);
// Path: databoundary/src/main/java/eu/rampsoftware/er/data/CurrencyData.java
// public class CurrencyData {
//     private final String mBaseCurrency;
//     private Date mDate;
//     private Map<String, Double> mCurrencies;
// 
//     public CurrencyData(final Date date, final Map<String, Double> currencies, final String baseCurrency) {
//         mDate = date;
//         mCurrencies = currencies;
//         mBaseCurrency = baseCurrency;
//     }
// 
//     public String getBaseCurrency() {
//         return mBaseCurrency;
//     }
// 
//     public Date getDate() {
//         return mDate;
//     }
// 
//     public Map<String, Double> getCurrencies() {
//         return mCurrencies;
//     }
// }
// 
// Path: databoundary/src/main/java/eu/rampsoftware/er/data/CurrencyRepository.java
// public interface CurrencyRepository {
// 
//     Observable<CurrencyData> getCurrencies(final Date date);
// 
//     Observable<SingleValue> getSeries(Date from, Date to, String currencyCode);
// }
// 
// Path: databoundary/src/main/java/eu/rampsoftware/er/data/PreferencesData.java
// public interface PreferencesData {
//     void setCurrenciesExchangeDate(Date date);
//     Optional<Date> getCurrenciesExchangeDate();
// }
// 
// Path: domain/src/main/java/eu/rampsoftware/er/domain/QueryUseCase.java
// public abstract class QueryUseCase<R, T> {
// 
//     private final Scheduler mWorkScheduler;
//     private final Scheduler mObserveScheduler;
// 
//     protected QueryUseCase(Scheduler workScheduler, Scheduler observeScheduler) {
//         this.mWorkScheduler = workScheduler;
//         this.mObserveScheduler = observeScheduler;
//     }
// 
//     public Observable<R> run(T params) {
//         final Observable<R> observable = this.buildUseCaseObservable(params)
//                 .subscribeOn(mWorkScheduler)
//                 .observeOn(mObserveScheduler);
//         return observable;
//     }
// 
//     protected abstract Observable<R> buildUseCaseObservable(final T params);
// 
// 
// }


// Path: domain/src/main/java/eu/rampsoftware/er/domain/usecases/GetCurrenciesUseCase.java
import java.util.Date;
import eu.rampsoftware.er.data.CurrencyData;
import eu.rampsoftware.er.data.CurrencyRepository;
import eu.rampsoftware.er.data.PreferencesData;
import eu.rampsoftware.er.domain.QueryUseCase;
import io.reactivex.Observable;
import io.reactivex.Scheduler;
import static com.fernandocejas.arrow.checks.Preconditions.checkNotNull;

package eu.rampsoftware.er.domain.usecases;




public class GetCurrenciesUseCase extends QueryUseCase<CurrencyData, GetCurrenciesUseCase.CurrenciesParam> {

    private final CurrencyRepository mRepository;
    private final PreferencesData mPreferences;

    public GetCurrenciesUseCase(final Scheduler workScheduler,
                                final Scheduler observeScheduler,
                                CurrencyRepository repository,
                                PreferencesData preferencesData) {
        super(workScheduler, observeScheduler);
        mRepository = repository;
        mPreferences = preferencesData;
    }

    @Override
    protected Observable<CurrencyData> buildUseCaseObservable(final CurrenciesParam params) {
        mPreferences.setCurrenciesExchangeDate(params.date);
        return mRepository.getCurrencies(params.date);