package com.crm.rely.backend.service;

import com.crm.rely.backend.core.constant.SmsSendEnum;
import com.crm.rely.backend.core.entity.system.sms.SysSmsEntity;
import com.crm.rely.backend.exception.ServiceException;

public interface SmsService extends BlackListService {

    /**
     * 发送短信
     *
     * @param sysSmsEntity 发送短信实体
     * @throws ServiceException
     */
    void sendSms(SysSmsEntity sysSmsEntity) throws ServiceException;

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

    void sendCode(SysSmsEntity sysSmsEntity, String code, boolean validate) throws ServiceException;
    /**
     * 发送短信验证码并保存到redis 过期时间为time 毫秒
     *
     * @param sysSmsEntity 发送短信实体
     * @param code         验证码
     * @param time         过期时间
     * @throws ServiceException
     */
    void sendCode(SysSmsEntity sysSmsEntity, String code, long time) throws ServiceException;

    void sendCode(SysSmsEntity sysSmsEntity, String code, boolean validate, long time) throws ServiceException;
    /**
     * 验证验证码是否存在 是否过期
     *
     * @param phone 手机号码
     * @param code  手机验证码
     * @throws ServiceException
     */
    void validateCode(String phone, String code) throws ServiceException;
}
