using HoneyBox.Admin.Models.AdminUser;
using HoneyBox.Admin.Models.Common;

namespace HoneyBox.Admin.Services;

/// <summary>
/// 管理员服务接口
/// </summary>
public interface IAdminUserService
{
    /// <summary>
    /// 获取管理员分页列表
    /// </summary>
    /// <param name="request">查询请求</param>
    /// <returns>分页结果</returns>
    Task<PagedResult<AdminUserDto>> GetListAsync(AdminUserQueryRequest request);

    /// <summary>
    /// 根据ID获取管理员详情
    /// </summary>
    /// <param name="id">管理员ID</param>
    /// <returns>管理员详情</returns>
    Task<AdminUserDto> GetByIdAsync(long id);

    /// <summary>
    /// 创建管理员
    /// </summary>
    /// <param name="request">创建请求</param>
    /// <param name="createdBy">创建人ID</param>
    /// <returns>新管理员ID</returns>
    Task<long> CreateAsync(CreateAdminUserRequest request, long? createdBy = null);

    /// <summary>
    /// 更新管理员
    /// </summary>
    /// <param name="id">管理员ID</param>
    /// <param name="request">更新请求</param>
    Task UpdateAsync(long id, UpdateAdminUserRequest request);

    /// <summary>
    /// 删除管理员
    /// </summary>
    /// <param name="id">管理员ID</param>
    Task DeleteAsync(long id);

    /// <summary>
    /// 获取管理员已分配的角色ID列表
    /// </summary>
    /// <param name="userId">管理员ID</param>
    /// <returns>角色ID列表</returns>
    Task<List<long>> GetRoleIdsAsync(long userId);

    /// <summary>
    /// 分配角色给管理员
    /// </summary>
    /// <param name="userId">管理员ID</param>
    /// <param name="roleIds">角色ID列表</param>
    Task AssignRolesAsync(long userId, List<long> roleIds);

    /// <summary>
    /// 获取管理员已分配的专属菜单ID列表
    /// </summary>
    /// <param name="userId">管理员ID</param>
    /// <returns>菜单ID列表</returns>
    Task<List<long>> GetMenuIdsAsync(long userId);

    /// <summary>
    /// 分配用户专属菜单
    /// </summary>
    /// <param name="userId">管理员ID</param>
    /// <param name="menuIds">菜单ID列表</param>
    Task AssignMenusAsync(long userId, List<long> menuIds);

    /// <summary>
    /// 分配部门
    /// </summary>
    /// <param name="userId">管理员ID</param>
    /// <param name="departmentId">部门ID</param>
    Task AssignDepartmentAsync(long userId, long? departmentId);

    /// <summary>
    /// 设置管理员状态
    /// </summary>
    /// <param name="userId">管理员ID</param>
    /// <param name="enabled">是否启用</param>
    /// <param name="ipAddress">客户端IP地址（用于撤销Token时记录）</param>
    Task SetStatusAsync(long userId, bool enabled, string? ipAddress = null);

    /// <summary>
    /// 重置密码
    /// </summary>
    /// <param name="userId">管理员ID</param>
    /// <param name="newPassword">新密码</param>
    Task ResetPasswordAsync(long userId, string newPassword);
}
