package cn.novalon.manage.sys.core.repository;

import cn.novalon.manage.sys.core.domain.SysRole;
import cn.novalon.manage.sys.core.query.SysRoleQuery;
import cn.novalon.manage.common.dto.PageRequest;
import cn.novalon.manage.common.dto.PageResponse;
import org.springframework.data.domain.Sort;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

/**
 * 角色仓储接口
 * 
 * @author 张翔
 * @date 2026-03-13
 */
public interface ISysRoleRepository {

    Mono<SysRole> findById(Long id);

    Mono<SysRole> findByIdIncludingDeleted(Long id);

    Mono<SysRole> save(SysRole sysRole);

    Mono<Void> deleteById(Long id);

    Flux<SysRole> findAll();

    Flux<SysRole> findAll(Sort sort);

    Flux<SysRole> findByRoleNameLikeOrRoleKeyLike(String roleName, String roleKey, Sort sort);

    Mono<Long> count();

    Mono<Long> countByRoleNameLikeOrRoleKeyLike(String roleName, String roleKey);

    Mono<PageResponse<SysRole>> findByQueryWithPagination(SysRoleQuery query, PageRequest pageRequest);

    Mono<SysRole> findByRoleName(String roleName);

    Mono<Boolean> existsByRoleName(String roleName);

    Mono<SysRole> updateRole(SysRole role);
}