package com.crm.ucard.service;

import com.crm.rely.backend.core.dto.base.BaseReportResultDto;
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.*;
import com.crm.rely.backend.core.entity.ucard.*;
import com.crm.rely.backend.exception.ServiceException;
import com.crm.ucard.config.UcardConfig;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

public interface UcardService {

    /**
     * 获取卡片类型列表
     */
    ResultWithPagerDto<CardTypeDto> getCardTypePageList(CardTypePageEntity entity) throws ServiceException;

    /**
     * 更新卡片类型列表
     */
    BaseResultDto getCardTypes() throws ServiceException;

    /**
     * 商户用户分页列表
     */
    ResultWithPagerDto<MerchantUserDto> getMerchantUserPageList(MerchantUserPageEntity entity) throws ServiceException;

    /**
     * 查询商户账户信息
     */
    BaseResultDto<List<MerchantAccountDto>> queryMerchantAccount() throws ServiceException;

    /**
     * 商户用户注册
     */
    BaseResultDto registerMerchantUser(MerchantUserEntity request) throws ServiceException;

    /**
     * 更新商户用户信息
     */
    BaseResultDto updateMerchantUser(MerchantUserEntity request) throws ServiceException;

    /**
     * 获取kyc认证分页列表
     */
    ResultWithPagerDto<CardKycStatusDto> getKycPageList(CardKycStatusPageEntity entity) throws ServiceException;

    /**
     * 商户用户KYC附件上传
     */
    BaseResultDto uploadKycAttachment(KycAttachmentUploadEntity request) throws ServiceException;

    /**
     * 提交KYC认证
     */
    BaseResultDto submitKyc(KycEntity request) throws ServiceException;

    /**
     * 查询KYC认证状态
     */
    BaseResultDto<KycStatusDto> queryKycStatus(KycEntity request) throws ServiceException;

    /**
     * 申请开卡
     */
    BaseResultDto applyCard(CardApplyEntity request) throws ServiceException;

    /**
     * 查询开卡进度
     */
    BaseResultDto queryApplyProgress(CardApplyProgressEntity request) throws ServiceException;

    /**
     * 获取卡片申请列表
     */
    ResultWithPagerDto<CardApplyDto> getCardApplyPageList(CardApplyPageEntity entity) throws ServiceException;

    /**
     * 获取卡片列表
     */
    ResultWithPagerDto<UcardCardDto> getCardPageList(CardPageEntity entity) throws ServiceException ;

    /**
     * 银行卡激活
     *
     * @param request 激活请求参数
     * @return 激活结果
     * @throws ServiceException 服务异常
     */
    BaseResultDto<CardActivateDto> activateCard(CardActivateEntity request) throws ServiceException;

    /**
     * 银行卡充值
     *
     * @param request 充值请求参数
     * @return 充值结果
     * @throws ServiceException 服务异常
     */

    BaseResultDto<CardRechargeDto> rechargeCard(CardRechargeEntity request) throws ServiceException;

    /**
     * 银行卡充值预估到账金额查询
     * @param request 查询请求参数
     * @return 预估到账金额
     * @throws ServiceException 服务异常
     */
    BaseResultDto<CardRechargeEstimateDto> queryRechargeEstimate(CardRechargeEstimateEntity request) throws ServiceException;

    /**
     * 银行卡充值订单查询
     * @param request 查询请求参数
     * @return 充值订单信息
     * @throws ServiceException 服务异常
     */
    BaseResultDto<CardRechargeOrderDto> queryRechargeOrder(CardRechargeOrderQueryEntity request) throws ServiceException;

    /**
     * 查询充值记录
     */
    BaseResultDto<CardRechargeOrderListDto> queryRechargeRecords(CardRechargeRecordQueryEntity request) throws ServiceException;

    /**
     * 充值记录分页查询
     */
    BaseReportResultDto<List<CardRechargeOrderDto>, CardRechargeOrderSumDto> queryRechargePageList(CardRechargePageEntity request) throws ServiceException;

    /**
     * 查询卡片余额
     */
    BaseResultDto queryCardBalance(CardBalanceEntity request) throws ServiceException;

    /**
     * 找回密码
     */
    BaseResultDto resetPassword(CardOperateEntity request) throws ServiceException;

    /**
     * 查询交易记录分页列表
     */
    ResultWithPagerDto<CardTransacOrderDto> getTransacOrderPageList(CardTransacOrderPageEntity request) throws ServiceException;

    /**
     * 查询交易记录
     */
    BaseResultDto<CardTransacOrderListDto> queryTransactions(CardTransacQueryEntity request) throws ServiceException;

    /**
     * 冻结卡片
     */
    BaseResultDto<CardFreezeDto> freezeCard(CardOperateEntity request) throws ServiceException;

    /**
     * 解冻卡片
     */
    BaseResultDto<CardFreezeDto> unfreezeCard(CardOperateEntity request) throws ServiceException;

    /**
     * 查询速汇银行及相关配置
     */
    BaseResultDto<List<GlobalTransferBankDto>> queryBankList() throws ServiceException;

    /**
     * 查询法币汇率
     */
    BaseResultDto<GlobalExchangeRateDto> queryExchangeRate(GlobalExchangeRateEntity request) throws ServiceException;

    /**
     * 代付校验
     */
    BaseResultDto validateTransfer(GlobalPaymentEntity request) throws ServiceException;

    /**
     * 代付付款人校验
     */
    BaseResultDto validatePayer(GlobalPayerEntity request) throws ServiceException;

    /**
     * 代付收款人校验
     */
    BaseResultDto validatePayee(GlobalPayeeEntity request) throws ServiceException;

    /**
     * 代付
     */
    BaseResultDto<GlobalPaymentDto> transfer(GlobalPaymentEntity request) throws ServiceException;

    /**
     * 用户代付订单列表
     */
    BaseResultDto<GlobalPaymentOrderListDto> queryOrderList(GlobalTransferOrderEntity request) throws ServiceException;

    /**
     * 用户代付订单分页查询
     */
    ResultWithPagerDto<GlobalPaymentOrderDto> queryOrderPageList(GlobalPaymentPageEntity request) throws ServiceException;

    /**
     * 提交调单信息或文件
     */
    BaseResultDto submitDispute(GlobalSubmitDisputeEntity request) throws ServiceException;

    /**
     * 查询代付订单结果
     */
    BaseResultDto<GlobalOrderInfoDto> queryOrderResult(GlobalOrderQueryEntity request) throws ServiceException;

    /**
     * 全球速汇-支付结果回调通知
     */
    void handleGlobalTransferNotify(GlobalTransferNotifyDto request,UcardConfig ucardConfig) throws ServiceException;

    /**
     * 全球速汇-调单回调通知
     */
    void handleGlobalTransferSubmitNotify(GlobalTransferSubmitNotifyDto request,UcardConfig ucardConfig) throws ServiceException;

    /**
     *  用户KYC回调通知
     */
    void handleKycNotify(KycNotifyDto notify,UcardConfig ucardConfig) throws ServiceException;

    /**
     * 银行卡-卡片充值结果回调通知
     */
    void handleCardRecharge(CardRechargeNotifyDto notify, UcardConfig ucardConfig) throws ServiceException;

    /**
     * 银行卡-卡片激活结果回调通知
     */
    void handleCardActivate(CardActivateNotifyDto notify) throws ServiceException;

    /**
     * 银行卡-卡片冻结、解冻、重发PIN处理状态回调通知
     */
    void handleCardFreeze(CardFreezeNotifyDto notify) throws ServiceException ;

    /**
     *  银行卡-3DS校验
     */
    void handleVerify3DS(CardVerify3DSNotifyDto notify) throws ServiceException ;

    /**
     * 银行卡-消费账单事件
     */
    void handCardBillStatement(CardTransacOrderNotifyDto notify) throws ServiceException ;

    /**
     * 上传文件
     * @param file
     * @return
     * @throws ServiceException
     */
    String uploadFile(MultipartFile file)throws ServiceException;

    /**
     * 查询国家和城市
     */
    List<CardCountryDto> getCardCountryList(CardCountryEntity request);

    /**
     * 银行卡交易信息数据定时同步
     */
    void queryOrderInfo() throws ServiceException;

}
