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.vaultody.VaultodyDepositAddressDto;
import com.crm.rely.backend.core.entity.ucard.vaultody.VaultodyDepositAddressPageEntity;
import com.crm.rely.backend.core.entity.ucard.vaultody.VaultodyResetDepositAddressEntity;
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/address/manager")
public class ManagerUcardWalletAddressController {

    @Autowired
    private VaultodyService vaultodyService;

    /**
     * 钱包地址分页列表
     */
    @PostMapping("/page")
    @FeignClientAnnotation
    ResultWithPagerDto<VaultodyDepositAddressDto> getDepositAddressPage(@RequestBody VaultodyDepositAddressPageEntity entity) throws ServiceException{
        return vaultodyService.getDepositAddressPage(entity);
    }

    /**
     * 重置钱包地址
     */
    @PostMapping("/reset")
    @FeignClientAnnotation
    BaseResultDto resetDepositAddress(@RequestBody VaultodyResetDepositAddressEntity entity) throws ServiceException{
        return vaultodyService.resetDepositAddress(entity);
    }

}
