using HoneyBox.Admin.Models.Common;
using HoneyBox.Admin.Models.Role;

namespace HoneyBox.Admin.Services;

/// <summary>
/// 角色服务接口
/// </summary>
public interface IRoleService
{
    /// <summary>
    /// 获取角色分页列表
    /// </summary>
    /// <param name="request">查询请求</param>
    /// <returns>分页结果</returns>
    Task<PagedResult<RoleDto>> GetListAsync(RoleQueryRequest request);

    /// <summary>
    /// 根据ID获取角色详情
    /// </summary>
    /// <param name="id">角色ID</param>
    /// <returns>角色详情</returns>
    Task<RoleDto> GetByIdAsync(long id);

    /// <summary>
    /// 创建角色
    /// </summary>
    /// <param name="request">创建请求</param>
    /// <returns>新角色ID</returns>
    Task<long> CreateAsync(CreateRoleRequest request);

    /// <summary>
    /// 更新角色
    /// </summary>
    /// <param name="id">角色ID</param>
    /// <param name="request">更新请求</param>
    Task UpdateAsync(long id, UpdateRoleRequest request);

    /// <summary>
    /// 删除角色
    /// </summary>
    /// <param name="id">角色ID</param>
    Task DeleteAsync(long id);

    /// <summary>
    /// 获取角色已分配的菜单ID列表
    /// </summary>
    /// <param name="roleId">角色ID</param>
    /// <returns>菜单ID列表</returns>
    Task<List<long>> GetMenuIdsAsync(long roleId);

    /// <summary>
    /// 分配菜单给角色
    /// </summary>
    /// <param name="roleId">角色ID</param>
    /// <param name="menuIds">菜单ID列表</param>
    Task AssignMenusAsync(long roleId, List<long> menuIds);

    /// <summary>
    /// 获取角色已分配的权限编码列表
    /// </summary>
    /// <param name="roleId">角色ID</param>
    /// <returns>权限编码列表</returns>
    Task<List<string>> GetPermissionCodesAsync(long roleId);

    /// <summary>
    /// 分配权限给角色
    /// </summary>
    /// <param name="roleId">角色ID</param>
    /// <param name="permissionCodes">权限编码列表</param>
    Task AssignPermissionsAsync(long roleId, List<string> permissionCodes);

    /// <summary>
    /// 获取所有角色（下拉选择用）
    /// </summary>
    /// <returns>角色列表</returns>
    Task<List<RoleDto>> GetAllAsync();
}
