package com.crm.manager.service;

import com.crm.rely.backend.core.dto.base.ResultWithPagerDto;
import com.crm.rely.backend.core.dto.user.role.UserAllRoleDto;
import com.crm.rely.backend.core.dto.user.role.UserNodeDisplayDto;
import com.crm.rely.backend.core.dto.user.role.UserRoleDto;
import com.crm.rely.backend.core.exception.ServiceException;
import com.crm.rely.backend.model.entity.user.role.*;

import java.util.List;

/**
 * 角色功能
 */
public interface UserRoleService {

    /**
     * 获取权限
     *
     * @param roleId
     * @return
     * @throws ServiceException
     */
    List<UserNodeDisplayDto> getUserNodeDisplay(Long roleId) throws ServiceException;

    /**
     * 判断角色是否存在
     *
     * @param roleId
     * @throws ServiceException
     */
    void existRole(Long roleId) throws ServiceException;

    /**
     * 添加角色信息
     *
     * @param sellerRoleAddEntity
     * @throws ServiceException
     */
    void addRoleInfo(UserRoleAddEntity sellerRoleAddEntity) throws ServiceException;

    /**
     * 修改角色信息(基础信息)
     *
     * @param sellerRoleUpdateEntity
     * @throws ServiceException
     */
    void updateRoleInfo(UserRoleUpdateEntity sellerRoleUpdateEntity) throws ServiceException;

    /**
     * 修改角色信息(权限)
     *
     * @param sellerRoleOperateListEntity
     * @throws ServiceException
     */
    void updateRoleInfo(UserRoleOperateListEntity sellerRoleOperateListEntity) throws ServiceException;

    /**
     * 删除角色信息
     *
     * @param roleId
     * @throws ServiceException
     */
    void deleteRoleInfo(Long roleId) throws ServiceException;

    /**
     * 单个获取角色信息
     *
     * @param roleId
     * @return
     * @throws ServiceException
     */
    UserRoleDto getRoleInfo(Long roleId) throws ServiceException;

    /**
     * 获取角色列表(分页)
     *
     * @param sellerRoleSearchEntity
     * @return
     * @throws ServiceException
     */
    ResultWithPagerDto<UserRoleDto> getListInfo(UserRoleSearchEntity sellerRoleSearchEntity) throws ServiceException;

    /**
     * 拉取所有角色(下拉使用)
     *
     * @return
     * @throws ServiceException
     */
    List<UserAllRoleDto> getListInfo() throws ServiceException;

    /**
     * 更新挂靠用户的数量
     *
     * @param entitys
     * @throws ServiceException
     */
    void updateNumber(List<UserRoleUpdateNumberEntity> entitys) throws ServiceException;

    /**
     * 更新挂靠用户的数量
     *
     * @param entity
     * @throws ServiceException
     */
    void updateNumber(UserRoleUpdateNumberEntity entity) throws ServiceException;

    String getRoleCodeById(Long id) throws ServiceException;


}
