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.vo.wallet.*;
import org.nest.springwrap.core.launch.app.AppNameConstant;
import org.nest.springwrap.core.mp.support.NestPage;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;


@FeignClient(
        value = AppNameConstant.SAAS_PAYMENT,
        fallbackFactory = WalletFeignFallback.class
)
public interface WalletFeign {

    /**
     * 获取或生成  钱包信息
     * @return 钱包信息
     */
    @PostMapping("/appletWallet/getOrCreateUserWalletInfo")
    R<UserWalletInfoVO> getOrCreateUserWalletInfo(@RequestBody CommonBaseDTO baseDTO);

    @PostMapping("/appletWallet/findWalletInfoList")
    R<UserWalletDataListVO> findWalletInfoList(@RequestBody CommonBaseDTO baseDTO);

    @GetMapping("/appletWallet/getWalletInfoData/{walletId}/{applyId}/{walletType}")
    R<UserWalletInfoVO> getWalletInfoData(@PathVariable Long walletId, @PathVariable Long applyId, @PathVariable String walletType);

    /**
     * 获取钱包账单明细列表
     * @param reqDTO 入参
     * @return 分页列表
     */
    @PostMapping("/appletWallet/findPageWalletBillInfo")
    R<NestPage<UserWalletBillInfoVO>> findPageWalletBillInfo(@Validated @RequestBody PageWalletBillReqDTO reqDTO);

    /**
     * 获取钱包账单收支总数
     * @param reqDTO 入参
     * @return 账单收支统计
     */
    @PostMapping("/appletWallet/getWalletBillCount")
    R<UserWalletBillCountVO> getWalletBillCount(@Validated @RequestBody PageWalletBillReqDTO reqDTO);

    /**
     * 发起钱包退款
     * @param walletId 钱包id
     * @return 钱包退款信息
     */
    @GetMapping("/appletWallet/startWalletRefund/{walletId}/{walletType}")
    R<UserWalletRefundVO> startWalletRefund(@PathVariable Long walletId, @PathVariable String walletType);

    /**
     * 创建钱包退款审核
     * @return false/true
     */
    @PostMapping("/appletWallet/createWalletRefundProcess")
    R<Boolean> createWalletRefundProcess(@Validated @RequestBody CreateUserWalletRefundReqDTO reqDTO);

    /**
     * 创建钱包退款审核
     * @return false/true
     */
    @PostMapping("/appletWallet/saveAutoDeduction")
    R<Boolean> saveAutoDeduction(@Validated @RequestBody AutoDeductionReqDTO reqDTO);

    @GetMapping("/appletWallet/getAutoDeductionInfo/{walletId}")
    R<WalletConfigInfoDataVO> getAutoDeductionInfo(@PathVariable Long walletId);

    /**
     * 设置余额不足提醒
     * @return false/true
     */
    @PostMapping("/appletWallet/saveBalanceInsufficient")
    R<Boolean> saveBalanceInsufficient(@Validated @RequestBody BalanceInsufficientReqDTO reqDTO);

    @GetMapping("/appletWallet/getBalanceInsufficientInfo/{walletId}")
    R<WalletConfigInfoDataVO> getBalanceInsufficientInfo(@PathVariable Long walletId);
    /**
     * 设置预付金额
     * @return false/true
     */
    @PostMapping("/appletWallet/savePrepayCost")
    R<Boolean> savePrepayCost(@Validated @RequestBody PrepayCostReqDTO reqDTO);

    @GetMapping("/appletWallet/getPrepayCostInfo/{walletId}")
    R<WalletConfigInfoDataVO> getPrepayCostInfo(@PathVariable Long walletId);

    @GetMapping("/appletWallet/getChargePrepayCostInfo/{walletId}")
    R<WalletConfigInfoDataVO> getChargePrepayCostInfo(@PathVariable Long walletId);

    /**
     * 冻结或解冻钱包金额
     * @return false/true
     */
    @PostMapping("/appletWallet/freezeOrThawWalletCost")
    R<Boolean> freezeOrThawWalletCost(@Validated @RequestBody FreezeUserWalletCostReqDTO reqDTO);

    /**
     * 无感支付使用接口
     */
    @PostMapping("/appletWallet/findNoFeelWalletPayData")
    R<UserWalletInfoVO> findNoFeelWalletPayData(@RequestBody NoFeelWalletPayDataReqDTO reqDTO);

    /**
     * 无感支付使用接口
     */
    @PostMapping("/appletWallet/findNoVehicleWalletPaySortInfo")
    R<List<UserWalletInfoVO>> findNoVehicleWalletPaySortInfo(@RequestBody NoFeelWalletPayDataReqDTO reqDTO);

    /**
     * 创建钱包流水接口
     */
    @PostMapping("/appletWallet/createWalletBillData")
    R<Boolean> createWalletBillData(@RequestBody CreateUserWalletBillReqDTO reqDTO);



}
