package com.crm.manager.service;

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.finance.rate.FinanceRateSearchDto;
import com.crm.rely.backend.core.entity.finance.rate.*;
import com.crm.rely.backend.core.entity.system.config.SendUpdateEmailCodeEntity;
import com.crm.rely.backend.exception.ServiceException;

import java.math.BigDecimal;
import java.util.List;

public interface FinanceRateService {

    /**
     * 添加配置
     *
     * @param entity
     * @throws ServiceException
     */
    void add(FinanceRateAddEntity entity) throws ServiceException;

    /**
     * 修改配置
     *
     * @param entity
     * @throws ServiceException
     */
    void update(FinanceRateUpdateEntity entity) throws ServiceException;

    void save(FinanceRateBatchUpdateEntity entity, List<FinanceRateUpdateEntity> entitys) throws ServiceException;

    /**
     * 删除配置
     *
     * @param entity
     * @throws ServiceException
     */
    void delete(FinanceRateDeleteEntity entity) throws ServiceException;

    /**
     * 根据条件查询配置
     *
     * @param entity
     * @return
     * @throws ServiceException
     */
//    ResultWithPagerDto<FinanceRateSearchDto> searchPageList(FinanceRateSearchListEntity entity) throws ServiceException;
    BaseResultDto searchList(FinanceRateSearchListEntity entity) throws ServiceException;

    /**
     * 根据条件 单个获取配置信息
     *
     * @param id
     * @return
     * @throws ServiceException
     */
    FinanceRateSearchDto searchSingle(Long id) throws ServiceException;

    void sendEmailCode(SendUpdateEmailCodeEntity entity) throws ServiceException;

    /**
     * 获取汇率
     *
     * @param currency
     * @param transformCurrency
     * @param type
     * @return
     * @throws ServiceException
     */
    BigDecimal getRate(String currency, String transformCurrency, Integer type) throws ServiceException;

    /**
     * 获取汇率转换货币金额
     *
     * @param currency
     * @param transformCurrency
     * @param type
     * @param amount
     * @return
     * @throws ServiceException
     */
    BigDecimal getRateAmount(String currency, String transformCurrency, Integer type, BigDecimal amount) throws ServiceException;

}
