// Path: domain/src/main/java/com/raulh82vlc/TransactionsViewer/domain/interactors/GetTransactionListInteractor.java
// public interface GetTransactionListInteractor {
// 
//     void execute(String path, GetTransactionsListCallback callback) throws CustomException;
// 
//     interface GetTransactionsListCallback {
//         void onGetTransactionsListOK(List<Transaction> transactionList);
// 
//         void onGetTransactionListKO(String error);
//     }
// }
// 
// Path: android/src/main/java/com/raulh82vlc/TransactionsViewer/domain/interactors/mappers/TransactionsListModelDataMapper.java
// @ActivityScope
// public class TransactionsListModelDataMapper {
// 
//     private static final String GBP = "GBP";
// 
//     @Inject
//     TransactionsListModelDataMapper() {
// 
//     }
// 
//     /**
//      * Transforms a List {@link Transaction} into an TreeMap of {@link Transaction}
//      * to maintain the order from A to Z sorted.
//      */
//     public TreeMap<String, List<Transaction>> transform(List<Transaction> transactionList) {
//         if (transactionList == null) {
//             throw new IllegalArgumentException("Cannot transform a null value");
//         }
//         TreeMap<String, List<Transaction>> map = new TreeMap<>();
//         for (Transaction transaction : transactionList) {
//             String key = transaction.getSkuIdentifier();
//             if (map.containsKey(key)) {
//                 map.get(key).add(transaction);
//             } else {
//                 List<Transaction> transactions = new ArrayList<>();
//                 transactions.add(transaction);
//                 map.put(key, transactions);
//             }
//         }
//         return map;
//     }
// 
//     public List<ProductUI> transform(Map<String, List<Transaction>> transactionsDictionary) {
//         if (transactionsDictionary == null) {
//             throw new IllegalArgumentException("Cannot transform a null value");
//         }
//         ProductUI productUI;
//         List<ProductUI> productUIs = new ArrayList<>();
//         for (Map.Entry<String, List<Transaction>> entry : transactionsDictionary.entrySet()) {
//             productUI = new ProductUI(entry.getKey(), entry.getValue(), GBP);
//             productUIs.add(productUI);
//         }
//         return productUIs;
//     }
// }
// 
// 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/ui/presentation/TransactionsPresenter.java
// public interface TransactionsPresenter {
//     void startReading(String path) throws CustomException;
// 
//     void setView(View view);
// 
//     void saveProducts(List<Transaction> transactionList, Map<String, List<Transaction>> transactionsMap)
//             throws CustomException;
// 
//     void resetView();
// 
//     interface View {
//         void saveProducts(Map<String, List<Transaction>> transactionsMap, List<Transaction> transactionList);
// 
//         void errorSavingProducts(String error);
// 
//         void productsSavedSuccessfully(String msg);
// 
//         void errorGettingTransactions(String error);
// 
//         void showProductsList(List<ProductUI> productUIs);
// 
//         void showEmptyState();
// 
//         boolean isReady();
//     }
// }


import com.raulh82vlc.TransactionsViewer.domain.interactors.GetTransactionListInteractor;
import com.raulh82vlc.TransactionsViewer.domain.interactors.mappers.TransactionsListModelDataMapper;
import com.raulh82vlc.TransactionsViewer.domain.models.Transaction;
import com.raulh82vlc.TransactionsViewer.ui.presentation.TransactionsPresenter;
import java.util.List;
/*
 * 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.interactors_response;



/**
 * Get Transactions List Callback communicating towards its view
 *
 * @author Raul Hernandez Lopez.
 */
public class GetTransactionsListCallbackImpl implements GetTransactionListInteractor.GetTransactionsListCallback {

    private final TransactionsPresenter.View mView;
    private final TransactionsListModelDataMapper transactionsListModelDataMapper;


    public GetTransactionsListCallbackImpl(TransactionsPresenter.View view,
                                           TransactionsListModelDataMapper transactionsListModelDataMapper) {
        mView = view;
        this.transactionsListModelDataMapper = transactionsListModelDataMapper;
    }

    @Override
// Path: domain/src/main/java/com/raulh82vlc/TransactionsViewer/domain/interactors/GetTransactionListInteractor.java
// public interface GetTransactionListInteractor {
// 
//     void execute(String path, GetTransactionsListCallback callback) throws CustomException;
// 
//     interface GetTransactionsListCallback {
//         void onGetTransactionsListOK(List<Transaction> transactionList);
// 
//         void onGetTransactionListKO(String error);
//     }
// }
// 
// Path: android/src/main/java/com/raulh82vlc/TransactionsViewer/domain/interactors/mappers/TransactionsListModelDataMapper.java
// @ActivityScope
// public class TransactionsListModelDataMapper {
// 
//     private static final String GBP = "GBP";
// 
//     @Inject
//     TransactionsListModelDataMapper() {
// 
//     }
// 
//     /**
//      * Transforms a List {@link Transaction} into an TreeMap of {@link Transaction}
//      * to maintain the order from A to Z sorted.
//      */
//     public TreeMap<String, List<Transaction>> transform(List<Transaction> transactionList) {
//         if (transactionList == null) {
//             throw new IllegalArgumentException("Cannot transform a null value");
//         }
//         TreeMap<String, List<Transaction>> map = new TreeMap<>();
//         for (Transaction transaction : transactionList) {
//             String key = transaction.getSkuIdentifier();
//             if (map.containsKey(key)) {
//                 map.get(key).add(transaction);
//             } else {
//                 List<Transaction> transactions = new ArrayList<>();
//                 transactions.add(transaction);
//                 map.put(key, transactions);
//             }
//         }
//         return map;
//     }
// 
//     public List<ProductUI> transform(Map<String, List<Transaction>> transactionsDictionary) {
//         if (transactionsDictionary == null) {
//             throw new IllegalArgumentException("Cannot transform a null value");
//         }
//         ProductUI productUI;
//         List<ProductUI> productUIs = new ArrayList<>();
//         for (Map.Entry<String, List<Transaction>> entry : transactionsDictionary.entrySet()) {
//             productUI = new ProductUI(entry.getKey(), entry.getValue(), GBP);
//             productUIs.add(productUI);
//         }
//         return productUIs;
//     }
// }
// 
// 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/ui/presentation/TransactionsPresenter.java
// public interface TransactionsPresenter {
//     void startReading(String path) throws CustomException;
// 
//     void setView(View view);
// 
//     void saveProducts(List<Transaction> transactionList, Map<String, List<Transaction>> transactionsMap)
//             throws CustomException;
// 
//     void resetView();
// 
//     interface View {
//         void saveProducts(Map<String, List<Transaction>> transactionsMap, List<Transaction> transactionList);
// 
//         void errorSavingProducts(String error);
// 
//         void productsSavedSuccessfully(String msg);
// 
//         void errorGettingTransactions(String error);
// 
//         void showProductsList(List<ProductUI> productUIs);
// 
//         void showEmptyState();
// 
//         boolean isReady();
//     }
// }


// Path: android/src/main/java/com/raulh82vlc/TransactionsViewer/domain/interactors_response/GetTransactionsListCallbackImpl.java
import com.raulh82vlc.TransactionsViewer.domain.interactors.GetTransactionListInteractor;
import com.raulh82vlc.TransactionsViewer.domain.interactors.mappers.TransactionsListModelDataMapper;
import com.raulh82vlc.TransactionsViewer.domain.models.Transaction;
import com.raulh82vlc.TransactionsViewer.ui.presentation.TransactionsPresenter;
import java.util.List;

/*
 * 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.interactors_response;



/**
 * Get Transactions List Callback communicating towards its view
 *
 * @author Raul Hernandez Lopez.
 */
public class GetTransactionsListCallbackImpl implements GetTransactionListInteractor.GetTransactionsListCallback {

    private final TransactionsPresenter.View mView;
    private final TransactionsListModelDataMapper transactionsListModelDataMapper;


    public GetTransactionsListCallbackImpl(TransactionsPresenter.View view,
                                           TransactionsListModelDataMapper transactionsListModelDataMapper) {
        mView = view;
        this.transactionsListModelDataMapper = transactionsListModelDataMapper;
    }

    @Override
    public void onGetTransactionsListOK(List<Transaction> transactionList) {