package com.crm.rely.backend.service;

import com.crm.rely.backend.core.entity.system.email.SupplementSendEmailBatchEntity;
import com.crm.rely.backend.core.entity.system.email.SupplementSendEmailEntity;
import com.crm.rely.backend.core.entity.system.email.SysEmailSendEntity;
import com.crm.rely.backend.exception.ServiceException;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public interface EmailService extends BlackListService {

    /**
     * 发送邮件 默认不验证
     *
     * @param sysEmailSendEntity 发送短信实体
     * @throws ServiceException
     */
    void sendEmail(SysEmailSendEntity sysEmailSendEntity) throws ServiceException;

    void sendEmail(SysEmailSendEntity sysEmailSendEntity,String queueName) throws ServiceException;

    void sendEmail(List<SysEmailSendEntity> sysEmailSendEntities) throws ServiceException;

    void sendEmail(SysEmailSendEntity sysEmailSendEntity, boolean validate, String queueName) throws ServiceException;

    void sendEmail(List<SysEmailSendEntity> sysEmailSendEntities, boolean validate, String queueName) throws ServiceException;

    /**
     * 发送邮件
     *
     * @param sysEmailSendEntity 发送短信实体
     * @param validate           是否验证盗刷
     * @throws ServiceException
     */
    void sendEmail(SysEmailSendEntity sysEmailSendEntity, boolean validate) throws ServiceException;

    void sendEmail(List<SysEmailSendEntity> sysEmailSendEntities, boolean validate) throws ServiceException;

    void sendEmailSupplement(Long id) throws ServiceException;

    void sendEmailSupplement(List<Long> ids) throws ServiceException;

    void sendEmailSupplement(SupplementSendEmailEntity entity) throws ServiceException;

    void sendEmailSupplement(SupplementSendEmailBatchEntity entity) throws ServiceException;

    /**
     * 发送邮件验证码并保存到redis 过期时间为五分钟
     *
     * @param sysEmailSendEntity 发送短信实体
     * @param code               验证码
     * @throws ServiceException
     */
    void sendCode(SysEmailSendEntity sysEmailSendEntity, String code) throws ServiceException;

    /**
     * 发送邮件验证码并保存到redis 过期时间为time 毫秒
     *
     * @param sysEmailSendEntity 发送邮件实体
     * @param code               验证码
     * @param time               过期时间
     * @throws ServiceException
     */
    void sendCode(SysEmailSendEntity sysEmailSendEntity, String code, long time) throws ServiceException;

    /**
     * 验证验证码是否存在 是否过期
     *
     * @param email 邮箱
     * @param code  邮件验证码
     * @throws ServiceException
     */
    void validateCode(String email, String code) throws ServiceException;
}
