package cn.novalon.gym.manage.sys.core.service;

import cn.novalon.gym.manage.sys.core.domain.SysUser;
import cn.novalon.gym.manage.common.dto.PageRequest;
import cn.novalon.gym.manage.common.dto.PageResponse;
import cn.novalon.gym.manage.sys.core.command.CreateUserCommand;
import cn.novalon.gym.manage.sys.core.command.UpdateUserCommand;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.util.List;

/**
 * 用户服务接口
 * 
 * @author 张翔
 * @date 2026-03-13
 */
public interface ISysUserService {
    Mono<SysUser> findById(Long id);

    Flux<SysUser> findAll();

    Flux<SysUser> findAll(boolean includeDeleted);

    Mono<PageResponse<SysUser>> findUsersByPage(PageRequest pageRequest);

    Mono<Long> count();

    Mono<SysUser> findByUsername(String username);

    Mono<Boolean> existsByUsername(String username);

    Mono<Boolean> existsByEmail(String email);

    Mono<SysUser> createUser(SysUser user);

    Mono<SysUser> createUser(CreateUserCommand command);

    Mono<SysUser> updateUser(SysUser user);

    Mono<SysUser> updateUser(UpdateUserCommand command);

    Mono<Void> deleteUser(Long id);

    Mono<Void> logicalDeleteUser(Long id);

    Mono<Void> logicalDeleteUsers(List<Long> ids);

    Mono<Void> restoreUser(Long id);

    Mono<Void> restoreUsers(List<Long> ids);

    Mono<SysUser> changePassword(Long userId, String oldPassword, String newPassword);

    Mono<Void> updateRoleIdToNullByRoleId(Long roleId);

    Mono<Void> assignRolesToUser(Long userId, java.util.List<Long> roleIds);

    Flux<cn.novalon.gym.manage.sys.core.domain.SysRole> getUserRoles(Long userId);

    Flux<Long> getUserRoleIds(Long userId);
}
