package com.yuchen.saas.payment.api.feign;

import com.yuchen.saas.payment.api.dto.CommonBaseDTO;
import com.yuchen.saas.payment.api.dto.applyWallet.PageWalletBillReqDTO;
import com.yuchen.saas.payment.api.dto.wallet.CreateUserWalletBillReqDTO;
import com.yuchen.saas.payment.api.dto.wallet.CreateUserWalletRefundReqDTO;
import com.yuchen.saas.payment.api.dto.wallet.FreezeUserWalletCostReqDTO;
import com.yuchen.saas.payment.api.dto.wallet.NoFeelWalletPayDataReqDTO;
import com.yuchen.saas.payment.api.dto.wallet.config.AutoDeductionReqDTO;
import com.yuchen.saas.payment.api.dto.wallet.config.BalanceInsufficientReqDTO;
import com.yuchen.saas.payment.api.dto.wallet.config.PrepayCostReqDTO;
import com.yuchen.saas.payment.api.util.PayFeignFallbackUtils;
import com.yuchen.saas.payment.api.vo.wallet.*;
import feign.hystrix.FallbackFactory;
import org.nest.springwrap.core.mp.support.NestPage;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.stereotype.Component;

import java.util.List;


@Component
public class WalletFeignFallback implements FallbackFactory<WalletFeign> {

    @Override
    public WalletFeign create(Throwable throwable) {
        return new WalletFeign() {

            @Override
            public R<UserWalletInfoVO> getOrCreateUserWalletInfo(CommonBaseDTO baseDTO) {
                return PayFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<UserWalletDataListVO> findWalletInfoList(CommonBaseDTO baseDTO) {
                return PayFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<UserWalletInfoVO> getWalletInfoData(Long walletId, Long applyId, String walletType) {
                return PayFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<NestPage<UserWalletBillInfoVO>> findPageWalletBillInfo(PageWalletBillReqDTO reqDTO) {
                return PayFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<UserWalletBillCountVO> getWalletBillCount(PageWalletBillReqDTO reqDTO) {
                return PayFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<UserWalletRefundVO> startWalletRefund(Long walletId, String walletType) {
                return PayFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<Boolean> createWalletRefundProcess(CreateUserWalletRefundReqDTO reqDTO) {
                return PayFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<Boolean> saveAutoDeduction(AutoDeductionReqDTO reqDTO) {
                return PayFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<WalletConfigInfoDataVO> getAutoDeductionInfo(Long walletId) {
                return PayFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<Boolean> saveBalanceInsufficient(BalanceInsufficientReqDTO reqDTO) {
                return PayFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<WalletConfigInfoDataVO> getBalanceInsufficientInfo(Long walletId) {
                return PayFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<Boolean> savePrepayCost(PrepayCostReqDTO reqDTO) {
                return PayFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<WalletConfigInfoDataVO> getPrepayCostInfo(Long walletId) {
                return PayFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<WalletConfigInfoDataVO> getChargePrepayCostInfo(Long walletId) {
                return PayFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<Boolean> freezeOrThawWalletCost(FreezeUserWalletCostReqDTO reqDTO) {
                return PayFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<UserWalletInfoVO> findNoFeelWalletPayData(NoFeelWalletPayDataReqDTO reqDTO) {
                return PayFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<List<UserWalletInfoVO>> findNoVehicleWalletPaySortInfo(NoFeelWalletPayDataReqDTO reqDTO) {
                return PayFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<Boolean> createWalletBillData(CreateUserWalletBillReqDTO reqDTO) {
                return PayFeignFallbackUtils.printLogAndReturn(throwable);
            }


        };
    }
}
