#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Common.Primitives;
using Lumina.Application.Common.DataAccess.Entities.Authorization;
using Lumina.Application.Common.Infrastructure.Authorization.Policies.Common.Base;
using Lumina.Domain.SharedKernel.Common.Enums.Authorization;
using System;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Common.Infrastructure.Authorization;
///
/// Interface for the service for managing authorization.
///
public interface IAuthorizationService
{
///
/// Determines whether the specified user has a specific permission.
///
/// The unique identifier of the user for whom to check the permission.
/// The permission to check.
/// Cancellation token that can be used to stop the execution.
/// if the user has the specified permission, otherwise.
Task HasPermissionAsync(Guid userId, AuthorizationPermission permission, CancellationToken cancellationToken);
///
/// Determines whether the specified user belongs to a specific role.
///
/// The unique identifier of the user for whom to check the role.
/// The role to check.
/// Cancellation token that can be used to stop the execution.
/// if the user is in the specified role, otherwise.
Task IsInRoleAsync(Guid userId, string role, CancellationToken cancellationToken);
///
/// Evaluates whether the specified user meets the conditions defined in the specified authorization policy.
///
/// The type of authorization policy to evaluate.
/// The unique identifier of the user for whom to evaluate the policy.
/// Cancellation token that can be used to stop the execution.
/// if the user satisfies the policy, otherwise.
Task EvaluatePolicyAsync(Guid userId, CancellationToken cancellationToken) where TAuthorizationPolicy : IAuthorizationPolicy;
///
/// Retrieves all authorization roles and permissions of a user identified by .
///
/// The unique identifier of the user for whom to retrieve the authorization roles and permissions.
/// Cancellation token that can be used to stop the execution.
/// An containing either a , or an error.
Task> GetUserAuthorizationAsync(Guid userId, CancellationToken cancellationToken);
}