// 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/SingleValue.java
// public class SingleValue {
//     private Date mDate;
//     private double mValue;
// 
//     public SingleValue(final Date date, final double value) {
//         mDate = date;
//         mValue = value;
//     }
// 
//     public Date getDate() {
//         return mDate;
//     }
// 
//     public double getValue() {
//         return mValue;
//     }
// 
//     @Override
//     public String toString() {
//         return "SingleValue{" +
//                 "mDate=" + mDate +
//                 ", mValue=" + mValue +
//                 '}';
//     }
// }
// 
// Path: data/src/main/java/eu/rampsoftware/er/data/datasource/CurrencyDataSource.java
// public interface CurrencyDataSource {
// 
//     Observable<CurrencyData> getCurrencies(Date date);
// 
//     boolean containsCurrencyValue(Date date, String currencyCode);
// 
//     boolean containsCurrencyValues(Date date);
// 
//     Observable<SingleValue> getCurrencyValues(Date startDate, Date endDate, String currencyCode);
// 
//     void storeCurrencies(CurrencyData currencyData);
// }
// 
// Path: data/src/main/java/eu/rampsoftware/er/data/datasource/remote/dto/CurrencyList.java
// public class CurrencyList {
// 
//     @SerializedName("disclaimer")
//     @Expose
//     private String disclaimer;
//     @SerializedName("license")
//     @Expose
//     private String license;
//     @SerializedName("timestamp")
//     @Expose
//     private Long timestamp;
//     @SerializedName("base")
//     @Expose
//     private String base;
//     @SerializedName("rates")
//     @Expose
//     private HashMap<String, Double> rates;
// 
//     public String getDisclaimer() {
//         return disclaimer;
//     }
// 
//     public void setDisclaimer(String disclaimer) {
//         this.disclaimer = disclaimer;
//     }
// 
//     public String getLicense() {
//         return license;
//     }
// 
//     public void setLicense(String license) {
//         this.license = license;
//     }
// 
//     public Long getTimestamp() {
//         return timestamp;
//     }
// 
//     public void setTimestamp(Long timestamp) {
//         this.timestamp = timestamp;
//     }
// 
//     public String getBase() {
//         return base;
//     }
// 
//     public void setBase(String base) {
//         this.base = base;
//     }
// 
//     public HashMap<String, Double> getRates() {
//         return rates;
//     }
// 
//     public void setRates(HashMap<String, Double> rates) {
//         this.rates = rates;
//     }
// 
// 
// }
// 
// Path: data/src/main/java/eu/rampsoftware/er/data/datasource/remote/mapper/CurrencyListMapper.java
// public class CurrencyListMapper {
// 
//     public static CurrencyData toCurrencyData(final CurrencyList currencyList) {
//         return new CurrencyData(new Date(currencyList.getTimestamp() * 1000), currencyList.getRates(), currencyList.getBase());
//     }
// }


import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import eu.rampsoftware.er.data.CurrencyData;
import eu.rampsoftware.er.data.SingleValue;
import eu.rampsoftware.er.data.datasource.CurrencyDataSource;
import eu.rampsoftware.er.data.datasource.remote.dto.CurrencyList;
import eu.rampsoftware.er.data.datasource.remote.mapper.CurrencyListMapper;
import io.reactivex.Observable;
import retrofit2.Response;
package eu.rampsoftware.er.data.datasource.remote;




public class RetrofitCurrencyDataSource implements CurrencyDataSource {

    private final String mAppId;
    private CurrencyDataApi mCurrencyDataApi;

    private SimpleDateFormat mDateFormatter = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());

    public RetrofitCurrencyDataSource(final CurrencyDataApi currencyDataApi,
                                      String appId){
        mCurrencyDataApi = currencyDataApi;
        mAppId = appId;
    }

    @Override
    public Observable<CurrencyData> getCurrencies(Date date) {

        final Observable<Response<CurrencyList>> request = mCurrencyDataApi.getCurrencies(mDateFormatter.format(date), mAppId);
        return request
                .flatMap(entryListDtoResponse -> Observable.just(entryListDtoResponse.body()))
                .flatMap(currencyList -> Observable.just(CurrencyListMapper.toCurrencyData(currencyList)));
    }

    @Override
    public boolean containsCurrencyValue(final Date date, final String currencyCode) {
        return false;
    }

    @Override
    public boolean containsCurrencyValues(final Date date) {
        return false;
    }

    @Override
// 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/SingleValue.java
// public class SingleValue {
//     private Date mDate;
//     private double mValue;
// 
//     public SingleValue(final Date date, final double value) {
//         mDate = date;
//         mValue = value;
//     }
// 
//     public Date getDate() {
//         return mDate;
//     }
// 
//     public double getValue() {
//         return mValue;
//     }
// 
//     @Override
//     public String toString() {
//         return "SingleValue{" +
//                 "mDate=" + mDate +
//                 ", mValue=" + mValue +
//                 '}';
//     }
// }
// 
// Path: data/src/main/java/eu/rampsoftware/er/data/datasource/CurrencyDataSource.java
// public interface CurrencyDataSource {
// 
//     Observable<CurrencyData> getCurrencies(Date date);
// 
//     boolean containsCurrencyValue(Date date, String currencyCode);
// 
//     boolean containsCurrencyValues(Date date);
// 
//     Observable<SingleValue> getCurrencyValues(Date startDate, Date endDate, String currencyCode);
// 
//     void storeCurrencies(CurrencyData currencyData);
// }
// 
// Path: data/src/main/java/eu/rampsoftware/er/data/datasource/remote/dto/CurrencyList.java
// public class CurrencyList {
// 
//     @SerializedName("disclaimer")
//     @Expose
//     private String disclaimer;
//     @SerializedName("license")
//     @Expose
//     private String license;
//     @SerializedName("timestamp")
//     @Expose
//     private Long timestamp;
//     @SerializedName("base")
//     @Expose
//     private String base;
//     @SerializedName("rates")
//     @Expose
//     private HashMap<String, Double> rates;
// 
//     public String getDisclaimer() {
//         return disclaimer;
//     }
// 
//     public void setDisclaimer(String disclaimer) {
//         this.disclaimer = disclaimer;
//     }
// 
//     public String getLicense() {
//         return license;
//     }
// 
//     public void setLicense(String license) {
//         this.license = license;
//     }
// 
//     public Long getTimestamp() {
//         return timestamp;
//     }
// 
//     public void setTimestamp(Long timestamp) {
//         this.timestamp = timestamp;
//     }
// 
//     public String getBase() {
//         return base;
//     }
// 
//     public void setBase(String base) {
//         this.base = base;
//     }
// 
//     public HashMap<String, Double> getRates() {
//         return rates;
//     }
// 
//     public void setRates(HashMap<String, Double> rates) {
//         this.rates = rates;
//     }
// 
// 
// }
// 
// Path: data/src/main/java/eu/rampsoftware/er/data/datasource/remote/mapper/CurrencyListMapper.java
// public class CurrencyListMapper {
// 
//     public static CurrencyData toCurrencyData(final CurrencyList currencyList) {
//         return new CurrencyData(new Date(currencyList.getTimestamp() * 1000), currencyList.getRates(), currencyList.getBase());
//     }
// }


// Path: data/src/main/java/eu/rampsoftware/er/data/datasource/remote/RetrofitCurrencyDataSource.java
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import eu.rampsoftware.er.data.CurrencyData;
import eu.rampsoftware.er.data.SingleValue;
import eu.rampsoftware.er.data.datasource.CurrencyDataSource;
import eu.rampsoftware.er.data.datasource.remote.dto.CurrencyList;
import eu.rampsoftware.er.data.datasource.remote.mapper.CurrencyListMapper;
import io.reactivex.Observable;
import retrofit2.Response;

package eu.rampsoftware.er.data.datasource.remote;




public class RetrofitCurrencyDataSource implements CurrencyDataSource {

    private final String mAppId;
    private CurrencyDataApi mCurrencyDataApi;

    private SimpleDateFormat mDateFormatter = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());

    public RetrofitCurrencyDataSource(final CurrencyDataApi currencyDataApi,
                                      String appId){
        mCurrencyDataApi = currencyDataApi;
        mAppId = appId;
    }

    @Override
    public Observable<CurrencyData> getCurrencies(Date date) {

        final Observable<Response<CurrencyList>> request = mCurrencyDataApi.getCurrencies(mDateFormatter.format(date), mAppId);
        return request
                .flatMap(entryListDtoResponse -> Observable.just(entryListDtoResponse.body()))
                .flatMap(currencyList -> Observable.just(CurrencyListMapper.toCurrencyData(currencyList)));
    }

    @Override
    public boolean containsCurrencyValue(final Date date, final String currencyCode) {
        return false;
    }

    @Override
    public boolean containsCurrencyValues(final Date date) {
        return false;
    }

    @Override
    public Observable<SingleValue> getCurrencyValues(final Date startDate, final Date endDate, final String currencyCode) {