// 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/interactors/ComputeTransactionsInteractor.java
// public interface ComputeTransactionsInteractor {
// 
//     void execute(String skuFromProduct,
//                  GetTransactionsComputedCallback getTransactionsComputedCallback,
//                  String toCurrency,
//                  String pathTransactions, String pathRates) throws CustomException;
// 
// 
//     interface GetTransactionsComputedCallback {
//         void onGetTransactionsListOK(List<TransactionRatedDomain> transactionList, String totalAmount);
// 
//         void onGetTransactionListKO(String error);
//     }
// }
// 
// Path: android/src/main/java/com/raulh82vlc/TransactionsViewer/domain/interactors/mappers/TransactionsRatedDataMapper.java
// @ActivityScope
// public class TransactionsRatedDataMapper {
// 
//     @Inject
//     TransactionsRatedDataMapper() {
// 
//     }
// 
//     public List<TransactionUI> transformToUI(List<TransactionRatedDomain> transactionList) {
//         if (transactionList == null) {
//             throw new IllegalArgumentException("Cannot transform a null value");
//         }
// 
//         List<TransactionUI> transactionUIDomList = new ArrayList<>();
//         for (TransactionRatedDomain transactionRated : transactionList) {
//             transactionUIDomList.add(new TransactionUI(transactionRated.getCurrencyPrev(),
//                     transactionRated.getCurrencyCurrent(), transactionRated.getAmounPerTransactionPrev().toString(),
//                     transactionRated.getAmountPerTransactionCurrent().toString()));
//         }
//         return transactionUIDomList;
//     }
// }
// 
// Path: android/src/main/java/com/raulh82vlc/TransactionsViewer/domain/interactors_response/GetTransactionsComputedCallbackImpl.java
// public class GetTransactionsComputedCallbackImpl implements
//         ComputeTransactionsInteractor.GetTransactionsComputedCallback {
// 
//     private final ComputingTransactionsPresenter.View mView;
//     private final TransactionsRatedDataMapper transactionsRatedDataMapper;
// 
//     public GetTransactionsComputedCallbackImpl(ComputingTransactionsPresenter.View  view,
//                                      TransactionsRatedDataMapper transactionsRatedDataMapper) {
//         mView = view;
//         this.transactionsRatedDataMapper = transactionsRatedDataMapper;
//     }
// 
//     @Override
//     public void onGetTransactionsListOK(List<TransactionRatedDomain> transactionList, String totalAmount) {
//         if (mView.isReady()) {
//             mView.computedRatesForTransactions(transactionsRatedDataMapper.transformToUI(transactionList), totalAmount);
//             mView.visibilityChangesAfterSuccessfulComputedRates();
//         }
//     }
// 
//     @Override
//     public void onGetTransactionListKO(String error) {
//         if (mView.isReady()) {
//             mView.errorComputingRates(error);
//             mView.visibilityChangesAfterErrorComputedRates();
//         }
//     }
// }


import com.raulh82vlc.TransactionsViewer.domain.exceptions.CustomException;
import com.raulh82vlc.TransactionsViewer.domain.interactors.ComputeTransactionsInteractor;
import com.raulh82vlc.TransactionsViewer.domain.interactors.mappers.TransactionsRatedDataMapper;
import com.raulh82vlc.TransactionsViewer.domain.interactors_response.GetTransactionsComputedCallbackImpl;
import javax.inject.Inject;
/*
 * 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.ui.presentation;



/**
 * Implementation of {@link ComputingTransactionsPresenter}
 *
 * @author Raul Hernandez Lopez.
 */

public class ComputingTransactionsPresenterImpl implements ComputingTransactionsPresenter {
    private final ComputeTransactionsInteractor interactor;
    private final TransactionsRatedDataMapper transactionsRatedDataMapper;
    private View view;

    @Inject
    ComputingTransactionsPresenterImpl(ComputeTransactionsInteractor computeTransactionsInteractor,
                                       TransactionsRatedDataMapper transactionsRatedDataMapper) {
        this.interactor = computeTransactionsInteractor;
        this.transactionsRatedDataMapper = transactionsRatedDataMapper;
    }

    @Override
    public void setView(View view) {
        if (view == null) {
            throw new IllegalArgumentException("The view should be instantiated");
        }
        this.view = view;
    }

    @Override
    public void resetView() {
        view = null;
    }

// 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/interactors/ComputeTransactionsInteractor.java
// public interface ComputeTransactionsInteractor {
// 
//     void execute(String skuFromProduct,
//                  GetTransactionsComputedCallback getTransactionsComputedCallback,
//                  String toCurrency,
//                  String pathTransactions, String pathRates) throws CustomException;
// 
// 
//     interface GetTransactionsComputedCallback {
//         void onGetTransactionsListOK(List<TransactionRatedDomain> transactionList, String totalAmount);
// 
//         void onGetTransactionListKO(String error);
//     }
// }
// 
// Path: android/src/main/java/com/raulh82vlc/TransactionsViewer/domain/interactors/mappers/TransactionsRatedDataMapper.java
// @ActivityScope
// public class TransactionsRatedDataMapper {
// 
//     @Inject
//     TransactionsRatedDataMapper() {
// 
//     }
// 
//     public List<TransactionUI> transformToUI(List<TransactionRatedDomain> transactionList) {
//         if (transactionList == null) {
//             throw new IllegalArgumentException("Cannot transform a null value");
//         }
// 
//         List<TransactionUI> transactionUIDomList = new ArrayList<>();
//         for (TransactionRatedDomain transactionRated : transactionList) {
//             transactionUIDomList.add(new TransactionUI(transactionRated.getCurrencyPrev(),
//                     transactionRated.getCurrencyCurrent(), transactionRated.getAmounPerTransactionPrev().toString(),
//                     transactionRated.getAmountPerTransactionCurrent().toString()));
//         }
//         return transactionUIDomList;
//     }
// }
// 
// Path: android/src/main/java/com/raulh82vlc/TransactionsViewer/domain/interactors_response/GetTransactionsComputedCallbackImpl.java
// public class GetTransactionsComputedCallbackImpl implements
//         ComputeTransactionsInteractor.GetTransactionsComputedCallback {
// 
//     private final ComputingTransactionsPresenter.View mView;
//     private final TransactionsRatedDataMapper transactionsRatedDataMapper;
// 
//     public GetTransactionsComputedCallbackImpl(ComputingTransactionsPresenter.View  view,
//                                      TransactionsRatedDataMapper transactionsRatedDataMapper) {
//         mView = view;
//         this.transactionsRatedDataMapper = transactionsRatedDataMapper;
//     }
// 
//     @Override
//     public void onGetTransactionsListOK(List<TransactionRatedDomain> transactionList, String totalAmount) {
//         if (mView.isReady()) {
//             mView.computedRatesForTransactions(transactionsRatedDataMapper.transformToUI(transactionList), totalAmount);
//             mView.visibilityChangesAfterSuccessfulComputedRates();
//         }
//     }
// 
//     @Override
//     public void onGetTransactionListKO(String error) {
//         if (mView.isReady()) {
//             mView.errorComputingRates(error);
//             mView.visibilityChangesAfterErrorComputedRates();
//         }
//     }
// }


// Path: android/src/main/java/com/raulh82vlc/TransactionsViewer/ui/presentation/ComputingTransactionsPresenterImpl.java
import com.raulh82vlc.TransactionsViewer.domain.exceptions.CustomException;
import com.raulh82vlc.TransactionsViewer.domain.interactors.ComputeTransactionsInteractor;
import com.raulh82vlc.TransactionsViewer.domain.interactors.mappers.TransactionsRatedDataMapper;
import com.raulh82vlc.TransactionsViewer.domain.interactors_response.GetTransactionsComputedCallbackImpl;
import javax.inject.Inject;

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



/**
 * Implementation of {@link ComputingTransactionsPresenter}
 *
 * @author Raul Hernandez Lopez.
 */

public class ComputingTransactionsPresenterImpl implements ComputingTransactionsPresenter {
    private final ComputeTransactionsInteractor interactor;
    private final TransactionsRatedDataMapper transactionsRatedDataMapper;
    private View view;

    @Inject
    ComputingTransactionsPresenterImpl(ComputeTransactionsInteractor computeTransactionsInteractor,
                                       TransactionsRatedDataMapper transactionsRatedDataMapper) {
        this.interactor = computeTransactionsInteractor;
        this.transactionsRatedDataMapper = transactionsRatedDataMapper;
    }

    @Override
    public void setView(View view) {
        if (view == null) {
            throw new IllegalArgumentException("The view should be instantiated");
        }
        this.view = view;
    }

    @Override
    public void resetView() {
        view = null;
    }

    @Override