using MilitaryTrainingManagement.Models.Enums;

namespace MilitaryTrainingManagement.Authorization;

/// <summary>
/// 组织层级授权服务接口
/// </summary>
public interface IOrganizationalAuthorizationService
{
    /// <summary>
    /// 检查用户是否可以访问指定组织单位的资源
    /// </summary>
    Task<bool> CanAccessUnitAsync(int userUnitId, int targetUnitId);

    /// <summary>
    /// 检查用户层级是否满足最低要求
    /// </summary>
    bool HasMinimumLevel(OrganizationalLevel userLevel, OrganizationalLevel minimumLevel);

    /// <summary>
    /// 获取用户可访问的所有组织单位ID（包括自身和所有下级）
    /// </summary>
    Task<IEnumerable<int>> GetAccessibleUnitIdsAsync(int userUnitId);

    /// <summary>
    /// 检查目标单位是否是当前单位的上级单位
    /// </summary>
    Task<bool> IsAncestorUnitAsync(int targetUnitId, int currentUnitId);
}
