using Microsoft.AspNetCore.Mvc.Filters;
using Netina.Domain.Models.Claims;
using AuthorizeAttribute = Microsoft.AspNetCore.Authorization.AuthorizeAttribute;

namespace Netina.AdminPanel.PWA.Utilities;

[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public class PermissionAuthorizeAttribute : AuthorizeAttribute, IAuthorizationFilter
{
    private readonly string[] _permissions;

    public PermissionAuthorizeAttribute(params string[] permission)
    {
        _permissions = permission;
    }
    public void OnAuthorization(AuthorizationFilterContext context)
    {
        var user = context.HttpContext.User;
        var permissions = user.Claims?.Where(c => c.Type == CustomClaimType.Permission)?.ToList();
        if (permissions == null)
        {

        }
        else
        {

        }
    }
}


