package cn.skcks.matrix.v2.services.role;

import cn.skcks.matrix.v2.model.role.dto.RoleRoutePermission;
import cn.skcks.matrix.v2.model.services.ServiceResult;
import cn.skcks.matrix.v2.orm.mybatis.dynamic.model.Role;
import cn.skcks.matrix.v2.orm.mybatis.dynamic.model.User;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public interface RoleService {
    PageInfo<Role> getRoles(int page, int size, boolean all);

    void initRole(String role, String name, boolean active);

    void grantRoleForUser(String userId, String role, String system) throws Exception;

    void revokeRoleForUser(String userId, String role, String system) throws Exception;

    List<String> getUserRoles(String userId, String system);

    List<User> getRoleUsers(String role, String system);

    ServiceResult<Void> addRole(String roleName, String role, String system, List<RoleRoutePermission> permissions) throws Exception;

    ServiceResult<Void> delRole(String role, String system) throws Exception;
}
