package com.qmth.teachcloud.common.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.qmth.teachcloud.common.bean.params.SysRolePrivilegeParams;
import com.qmth.teachcloud.common.entity.SysRole;
import com.qmth.teachcloud.common.enums.RoleTypeEnum;

import java.security.NoSuchAlgorithmException;
import java.util.List;

/**
 * <p>
 * 角色表 服务类
 * </p>
 *
 * @author xf
 * @since 2021-03-23
 */
public interface SysRoleService extends IService<SysRole> {

    IPage<SysRole> list(String name, Boolean enable, Integer pageNumber, Integer pageSize);

    /**
     * 新增角色
     *
     * @param sysRolePrivilegeParams
     * @return
     */
    boolean saveRoleNew(SysRolePrivilegeParams sysRolePrivilegeParams);

    boolean saveRoleReportNew(SysRole role);

    boolean enable(SysRole role) throws NoSuchAlgorithmException;

    boolean enableReport(SysRole role) throws NoSuchAlgorithmException;

    boolean remove(Long id);

    boolean removeReport(Long id);

    List<Long> listUserRoleIds(Long userId);

    List<SysRole> listRolesByUserId(Long userId);

    List<SysRole> list(Long[] roleIds, String name);

    List<SysRole> listToUser();
    List<SysRole> listToAdmin();

    /**
     * 查询自定义角色
     *
     * @return
     */
    List<SysRole> findCustomRole();

    boolean builtin(Long id, boolean defaultRole);

    List<SysRole> getByRoleName(Long schoolId, String roleName);

    SysRole getDefaultRoleByType(RoleTypeEnum type);
}
