package com.crm.ucard.controller;

import com.crm.rely.backend.core.constant.FeignClientAnnotation;
import com.crm.rely.backend.core.dto.base.BaseResultDto;
import com.crm.rely.backend.core.dto.base.ResultWithPagerDto;
import com.crm.rely.backend.core.dto.ucard.UcardWalletWithdrawDto;
import com.crm.rely.backend.core.entity.ucard.CardWalletWithdrawApproveEntity;
import com.crm.rely.backend.core.entity.ucard.UcardWalletWithdrawPageEntity;
import com.crm.rely.backend.core.entity.ucard.WalletWithdrawApplyEntity;
import com.crm.rely.backend.exception.ServiceException;
import com.crm.ucard.service.VaultodyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 银行卡服务接口
 */
@Slf4j
@RestController
@RequestMapping("/ucard/wallet/withdraw/manager")
public class ManagerUcardWalletWithdrawController {

    @Autowired
    private VaultodyService vaultodyService;

    /**
     * 钱包提款分页列表
     */
    @PostMapping("/page")
    @FeignClientAnnotation
    ResultWithPagerDto<UcardWalletWithdrawDto> getWalletWithdrawPage(@RequestBody UcardWalletWithdrawPageEntity entity) throws ServiceException{
        return vaultodyService.getWalletWithdrawPage(entity);
    }

    /**
     * 钱包提款申请
     */
    @PostMapping("/apply")
    @FeignClientAnnotation
    BaseResultDto walletWithdrawApply(@RequestBody WalletWithdrawApplyEntity entity) throws Exception{
        return vaultodyService.walletWithdrawApply(entity);
    }

    /**
     * 钱包提款审核
     */
    @PostMapping("/approve")
    @FeignClientAnnotation
    BaseResultDto walletWithdrawApprove(@RequestBody CardWalletWithdrawApproveEntity entity) throws Exception{
        return vaultodyService.walletWithdrawApprove(entity);
    }

}
