// Path: android/src/main/java/com/raulh82vlc/TransactionsViewer/domain/datasources/json/JSONDataSourceImpl.java
// public class JSONDataSourceImpl implements JSONDataSource<Rate, Transaction> {
// 
//     /**
//      * Vars declaration
//      */
//     private Context mContext;
//     private JSONOperations<Rate, Transaction> mJSONOperations;
// 
//     @Inject
//     JSONDataSourceImpl(Context context,
//                        JSONOperationsImpl jsonOperations) {
//         mContext = context;
//         if (mJSONOperations == null) {
//             synchronized (this) {
//                 if (mJSONOperations == null) {
//                     mJSONOperations = jsonOperations;
//                 }
//             }
//         }
//     }
// 
//     @Override
//     public List<Rate> getRatesList(String path) throws CustomException {
//         return startToReadRatesFromFile(path);
//     }
// 
//     @Override
//     public List<Transaction> getTransactionsList(String path) throws CustomException {
//         return startToReadTransactionsFromFile(path);
//     }
// 
//     /**
//      * Starts to read from file the Transactions List
//      *
//      * @return List of transactions
//      * @throws CustomException
//      */
//     private List<Transaction> startToReadTransactionsFromFile(String path) throws CustomException {
//         return mJSONOperations.getTransactionsList(mContext, path);
//     }
// 
//     /**
//      * Starts to read from file the Rates List
//      *
//      * @return List of rates
//      * @throws CustomException
//      */
//     private List<Rate> startToReadRatesFromFile(String path) throws CustomException {
//         return mJSONOperations.getRatesList(mContext, path);
//     }
// }
// 
// Path: domain/src/main/java/com/raulh82vlc/TransactionsViewer/domain/exceptions/CustomException.java
// public class CustomException extends Exception {
//     public CustomException(String detailMessage) {
//         super(detailMessage);
//     }
// }
// 
// Path: domain/src/main/java/com/raulh82vlc/TransactionsViewer/domain/models/Rate.java
// public class Rate {
//     @SerializedName("from")
//     private String fromCurrency;
//     @SerializedName("rate")
//     private String rate;
//     @SerializedName("to")
//     private String toCurrency;
// 
//     public String getFromCurrency() {
//         return fromCurrency;
//     }
// 
//     public String getRate() {
//         return rate;
//     }
// 
//     public String getToCurrency() {
//         return toCurrency;
//     }
// }
// 
// Path: domain/src/main/java/com/raulh82vlc/TransactionsViewer/domain/models/Transaction.java
// public class Transaction {
// 
//     @SerializedName("sku")
//     private String skuIdentifier;
// 
//     @SerializedName("amount")
//     private String amountPerTransaction;
// 
//     @SerializedName("currency")
//     private String currency;
// 
//     public String getSkuIdentifier() {
//         return skuIdentifier;
//     }
// 
//     public String getAmountPerTransaction() {
//         return amountPerTransaction;
//     }
// 
//     public String getCurrency() {
//         return currency;
//     }
// }
// 
// Path: android/src/main/java/com/raulh82vlc/TransactionsViewer/domain/repository/datasources/JSONDataSource.java
// public interface JSONDataSource<R, T> {
// 
//     /**
//      * Gets a Rates List from a JSON file
//      *
//      * @param path path of the file
//      */
//     List<R> getRatesList(String path) throws CustomException;
// 
//     /**
//      * Gets a Transactions List from a JSON file
//      *
//      * @param path path of the file
//      */
//     List<T> getTransactionsList(String path) throws CustomException;
// }


import javax.inject.Inject;
import com.raulh82vlc.TransactionsViewer.domain.datasources.json.JSONDataSourceImpl;
import com.raulh82vlc.TransactionsViewer.domain.exceptions.CustomException;
import com.raulh82vlc.TransactionsViewer.domain.models.Rate;
import com.raulh82vlc.TransactionsViewer.domain.models.Transaction;
import com.raulh82vlc.TransactionsViewer.domain.repository.datasources.JSONDataSource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/*
 * Copyright (C) 2017 Raul Hernandez Lopez @raulh82vlc
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.raulh82vlc.TransactionsViewer.domain.repository;





/**
 * <p>Implements {@link DataRepository} and allows to have one or more Datasource
 * like {@link JSONDataSource} or one another on it</p>
 *
 * @author Raul Hernandez Lopez
 */
public class JSONRepositoryImpl implements DataRepository<Rate, Transaction> {

    private static final int SUPPORTED_SIMULTANEOUS_PATHS = 1;
// Path: android/src/main/java/com/raulh82vlc/TransactionsViewer/domain/datasources/json/JSONDataSourceImpl.java
// public class JSONDataSourceImpl implements JSONDataSource<Rate, Transaction> {
// 
//     /**
//      * Vars declaration
//      */
//     private Context mContext;
//     private JSONOperations<Rate, Transaction> mJSONOperations;
// 
//     @Inject
//     JSONDataSourceImpl(Context context,
//                        JSONOperationsImpl jsonOperations) {
//         mContext = context;
//         if (mJSONOperations == null) {
//             synchronized (this) {
//                 if (mJSONOperations == null) {
//                     mJSONOperations = jsonOperations;
//                 }
//             }
//         }
//     }
// 
//     @Override
//     public List<Rate> getRatesList(String path) throws CustomException {
//         return startToReadRatesFromFile(path);
//     }
// 
//     @Override
//     public List<Transaction> getTransactionsList(String path) throws CustomException {
//         return startToReadTransactionsFromFile(path);
//     }
// 
//     /**
//      * Starts to read from file the Transactions List
//      *
//      * @return List of transactions
//      * @throws CustomException
//      */
//     private List<Transaction> startToReadTransactionsFromFile(String path) throws CustomException {
//         return mJSONOperations.getTransactionsList(mContext, path);
//     }
// 
//     /**
//      * Starts to read from file the Rates List
//      *
//      * @return List of rates
//      * @throws CustomException
//      */
//     private List<Rate> startToReadRatesFromFile(String path) throws CustomException {
//         return mJSONOperations.getRatesList(mContext, path);
//     }
// }
// 
// Path: domain/src/main/java/com/raulh82vlc/TransactionsViewer/domain/exceptions/CustomException.java
// public class CustomException extends Exception {
//     public CustomException(String detailMessage) {
//         super(detailMessage);
//     }
// }
// 
// Path: domain/src/main/java/com/raulh82vlc/TransactionsViewer/domain/models/Rate.java
// public class Rate {
//     @SerializedName("from")
//     private String fromCurrency;
//     @SerializedName("rate")
//     private String rate;
//     @SerializedName("to")
//     private String toCurrency;
// 
//     public String getFromCurrency() {
//         return fromCurrency;
//     }
// 
//     public String getRate() {
//         return rate;
//     }
// 
//     public String getToCurrency() {
//         return toCurrency;
//     }
// }
// 
// Path: domain/src/main/java/com/raulh82vlc/TransactionsViewer/domain/models/Transaction.java
// public class Transaction {
// 
//     @SerializedName("sku")
//     private String skuIdentifier;
// 
//     @SerializedName("amount")
//     private String amountPerTransaction;
// 
//     @SerializedName("currency")
//     private String currency;
// 
//     public String getSkuIdentifier() {
//         return skuIdentifier;
//     }
// 
//     public String getAmountPerTransaction() {
//         return amountPerTransaction;
//     }
// 
//     public String getCurrency() {
//         return currency;
//     }
// }
// 
// Path: android/src/main/java/com/raulh82vlc/TransactionsViewer/domain/repository/datasources/JSONDataSource.java
// public interface JSONDataSource<R, T> {
// 
//     /**
//      * Gets a Rates List from a JSON file
//      *
//      * @param path path of the file
//      */
//     List<R> getRatesList(String path) throws CustomException;
// 
//     /**
//      * Gets a Transactions List from a JSON file
//      *
//      * @param path path of the file
//      */
//     List<T> getTransactionsList(String path) throws CustomException;
// }


// Path: android/src/main/java/com/raulh82vlc/TransactionsViewer/domain/repository/JSONRepositoryImpl.java
import javax.inject.Inject;
import com.raulh82vlc.TransactionsViewer.domain.datasources.json.JSONDataSourceImpl;
import com.raulh82vlc.TransactionsViewer.domain.exceptions.CustomException;
import com.raulh82vlc.TransactionsViewer.domain.models.Rate;
import com.raulh82vlc.TransactionsViewer.domain.models.Transaction;
import com.raulh82vlc.TransactionsViewer.domain.repository.datasources.JSONDataSource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

/*
 * Copyright (C) 2017 Raul Hernandez Lopez @raulh82vlc
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.raulh82vlc.TransactionsViewer.domain.repository;





/**
 * <p>Implements {@link DataRepository} and allows to have one or more Datasource
 * like {@link JSONDataSource} or one another on it</p>
 *
 * @author Raul Hernandez Lopez
 */
public class JSONRepositoryImpl implements DataRepository<Rate, Transaction> {

    private static final int SUPPORTED_SIMULTANEOUS_PATHS = 1;
    private JSONDataSource<Rate, Transaction> mJsonDataSource;