using Microsoft.AspNetCore.Authorization;

namespace ROLAC.API.Authorization;

/// <summary>
/// Authorization requirement carrying the module + action a request needs.
/// Materialized on demand by <see cref="PermissionPolicyProvider"/> from a policy
/// name of the form <c>PERM:&lt;module&gt;:&lt;action&gt;</c>.
/// </summary>
public class PermissionRequirement : IAuthorizationRequirement
{
    public string Module { get; }
    public string Action { get; }

    public PermissionRequirement(string module, string action)
    {
        Module = module;
        Action = action;
    }
}
