package com.crm.custom.service;

import com.crm.rely.backend.core.entity.base.LongEntitys;
import com.crm.rely.backend.core.exception.ServiceException;
import com.crm.rely.backend.model.entity.custom.info.*;
import com.crm.rely.backend.model.pojo.table.CustomInfoTable;
import org.springframework.web.multipart.MultipartFile;

import java.math.BigDecimal;

/**
 * @program: crm-backend
 * @description:
 * @author: houn
 * @create: 2019-07-25 16:12
 */
public interface CustomInfoService {

    /**
     * 用户登录
     *
     * @param entity
     * @return
     * @throws ServiceException
     */
    CustomInfoEntity login(CustomInfoLoginEntity entity) throws ServiceException;

    /**
     * 注册发送邮箱验证码
     *
     * @param entity
     * @throws ServiceException
     */
    void registerSendEmailCode(CustomInfoRegisterSendEmailCodeEntity entity) throws ServiceException;

    CustomInfoTable applyReal(CustomApplyRealEntity entity) throws ServiceException;

    void updateEmailSendEmailCode(CustomInfoUpdateEmailSendEmailCodeEntity entity) throws ServiceException;

    /**
     * 添加用户信息
     *
     * @param entity
     * @throws ServiceException
     */
    void add(CustomInfoRegisterEntity entity) throws ServiceException, InterruptedException;

    /**
     * 修改用户信息
     *
     * @param entity
     * @throws ServiceException
     */
    void update(CustomInfoUpdateEntity entity) throws ServiceException;

    void updateEmail(CustomInfoUpdateEmailEntity entity) throws ServiceException;


    void validated(MultipartFile file) throws ServiceException;

    String updateHeadPicture(CustomInfoUpdateHeadPictureEntity entity, MultipartFile file) throws Exception;

    /**
     * 登录状态下修改密码
     *
     * @param entity
     * @throws ServiceException
     */
    void updatePassword(CustomUpdateLoginPasswordEntity entity) throws ServiceException;

    void updatePasswordSendEmail(CustomUpdatePasswordSendEmailEntity entity) throws ServiceException;

    void updatePassword(CustomUpdateEmailPasswordEntity entity) throws ServiceException;

    /**
     * 批量删除信息
     *
     * @param entitys
     * @throws Exception
     */
    void deleteInBatch(LongEntitys entitys) throws Exception;

    CustomInfoTable getById(Long id) throws ServiceException;

    void updatePosition(Long customId, Integer position) throws ServiceException;

    void updateAgentId(CustomInfoUpdateAgentEntity entity) throws ServiceException;

    void validPosition(Long customId, Integer position) throws ServiceException;

    Integer getPosition(Long customId) throws ServiceException;

    BigDecimal getBalance(Long id) throws ServiceException;
}
