using Microsoft.AspNetCore.Authorization;
using Netina.Domain.Models.Claims;

namespace Netina.AdminPanel.PWA.Utilities;

public static class PoliciesUtility
{
    public static void ConfigPolicies(this AuthorizationOptions options)
    {
        ApplicationClaims.AllClaimDtos.ForEach(claim =>
        {
            options.AddPolicy(claim.Value, builder =>
            {
                builder.RequireClaim(CustomClaimType.Permission, claim.Value);
            });
        });
    }
}