// 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/GetRatesListInteractor.java
// public interface GetRatesListInteractor {
// 
//     void execute(String path, GetRatesListCallback callback) throws CustomException;
// 
//     interface GetRatesListCallback {
//         void onGetRatesListOK(List<Rate> rateList);
// 
//         void onGetRatesListKO(String error);
//     }
// }
// 
// Path: android/src/main/java/com/raulh82vlc/TransactionsViewer/domain/interactors/mappers/RatesListModelDataMapper.java
// @ActivityScope
// public class RatesListModelDataMapper {
// 
//     @Inject
//     RatesListModelDataMapper() {
// 
//     }
// 
//     /**
//      * Transforms a List of {@link Rate} into a List of Rates
//      *
//      * @param ratesList to be transformed.
//      * @return Graph composed by a dictionary of rate to others
//      */
//     public List<RateUI> transform(List<Rate> ratesList) {
//         if (ratesList == null) {
//             throw new IllegalArgumentException("Cannot transform a null value");
//         }
// 
//         int size = ratesList.size();
//         List<RateUI> listOfRates = new ArrayList<>(size);
//         if (size > 0) {
//             listOfRates = new ArrayList<>(size);
//             for (Rate rate : ratesList) {
//                 listOfRates.add(new RateUI(rate.getFromCurrency(), rate.getToCurrency(), rate.getRate()));
//             }
//         }
//         return listOfRates;
//     }
// }
// 
// Path: android/src/main/java/com/raulh82vlc/TransactionsViewer/domain/interactors_response/GetRatesListCallbackImpl.java
// public class GetRatesListCallbackImpl implements GetRatesListInteractor.GetRatesListCallback {
// 
//     private final RatesPresenter.View mView;
//     private final RatesListModelDataMapper ratesListModelDataMapper;
// 
// 
//     public GetRatesListCallbackImpl(RatesPresenter.View view,
//                              RatesListModelDataMapper ratesListModelDataMapper) {
//         mView = view;
//         this.ratesListModelDataMapper = ratesListModelDataMapper;
//     }
// 
//     @Override
//     public void onGetRatesListOK(List<Rate> rateList) {
//         if (mView.isReady()) {
//             mView.loadedRates(ratesListModelDataMapper.transform(rateList));
//         }
//     }
// 
//     @Override
//     public void onGetRatesListKO(String error) {
//         if (mView.isReady()) {
//             mView.errorGettingRates(error);
//         }
//     }
// }


import com.raulh82vlc.TransactionsViewer.domain.exceptions.CustomException;
import com.raulh82vlc.TransactionsViewer.domain.interactors.GetRatesListInteractor;
import com.raulh82vlc.TransactionsViewer.domain.interactors.mappers.RatesListModelDataMapper;
import com.raulh82vlc.TransactionsViewer.domain.interactors_response.GetRatesListCallbackImpl;
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 the {@link RatesPresenter}
 *
 * @author Raul Hernandez Lopez
 */
public class RatesPresenterImpl implements RatesPresenter {

    private final GetRatesListInteractor interactorGetRatesList;
    private final RatesListModelDataMapper ratesListModelDataMapper;
    private View view;

    @Inject
    RatesPresenterImpl(
// 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/GetRatesListInteractor.java
// public interface GetRatesListInteractor {
// 
//     void execute(String path, GetRatesListCallback callback) throws CustomException;
// 
//     interface GetRatesListCallback {
//         void onGetRatesListOK(List<Rate> rateList);
// 
//         void onGetRatesListKO(String error);
//     }
// }
// 
// Path: android/src/main/java/com/raulh82vlc/TransactionsViewer/domain/interactors/mappers/RatesListModelDataMapper.java
// @ActivityScope
// public class RatesListModelDataMapper {
// 
//     @Inject
//     RatesListModelDataMapper() {
// 
//     }
// 
//     /**
//      * Transforms a List of {@link Rate} into a List of Rates
//      *
//      * @param ratesList to be transformed.
//      * @return Graph composed by a dictionary of rate to others
//      */
//     public List<RateUI> transform(List<Rate> ratesList) {
//         if (ratesList == null) {
//             throw new IllegalArgumentException("Cannot transform a null value");
//         }
// 
//         int size = ratesList.size();
//         List<RateUI> listOfRates = new ArrayList<>(size);
//         if (size > 0) {
//             listOfRates = new ArrayList<>(size);
//             for (Rate rate : ratesList) {
//                 listOfRates.add(new RateUI(rate.getFromCurrency(), rate.getToCurrency(), rate.getRate()));
//             }
//         }
//         return listOfRates;
//     }
// }
// 
// Path: android/src/main/java/com/raulh82vlc/TransactionsViewer/domain/interactors_response/GetRatesListCallbackImpl.java
// public class GetRatesListCallbackImpl implements GetRatesListInteractor.GetRatesListCallback {
// 
//     private final RatesPresenter.View mView;
//     private final RatesListModelDataMapper ratesListModelDataMapper;
// 
// 
//     public GetRatesListCallbackImpl(RatesPresenter.View view,
//                              RatesListModelDataMapper ratesListModelDataMapper) {
//         mView = view;
//         this.ratesListModelDataMapper = ratesListModelDataMapper;
//     }
// 
//     @Override
//     public void onGetRatesListOK(List<Rate> rateList) {
//         if (mView.isReady()) {
//             mView.loadedRates(ratesListModelDataMapper.transform(rateList));
//         }
//     }
// 
//     @Override
//     public void onGetRatesListKO(String error) {
//         if (mView.isReady()) {
//             mView.errorGettingRates(error);
//         }
//     }
// }


// Path: android/src/main/java/com/raulh82vlc/TransactionsViewer/ui/presentation/RatesPresenterImpl.java
import com.raulh82vlc.TransactionsViewer.domain.exceptions.CustomException;
import com.raulh82vlc.TransactionsViewer.domain.interactors.GetRatesListInteractor;
import com.raulh82vlc.TransactionsViewer.domain.interactors.mappers.RatesListModelDataMapper;
import com.raulh82vlc.TransactionsViewer.domain.interactors_response.GetRatesListCallbackImpl;
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 the {@link RatesPresenter}
 *
 * @author Raul Hernandez Lopez
 */
public class RatesPresenterImpl implements RatesPresenter {

    private final GetRatesListInteractor interactorGetRatesList;
    private final RatesListModelDataMapper ratesListModelDataMapper;
    private View view;

    @Inject
    RatesPresenterImpl(
            GetRatesListInteractor interactorGetRatesList,