using Microsoft.AspNetCore.Http;

namespace TakeoutSaaS.Application.Dictionary.Services;

internal static class DictionaryAccessHelper
{
    internal static bool IsPlatformAdmin(IHttpContextAccessor httpContextAccessor)
    {
        var user = httpContextAccessor.HttpContext?.User;
        if (user?.Identity?.IsAuthenticated != true)
        {
            return false;
        }

        return user.IsInRole("PlatformAdmin") ||
               user.IsInRole("platform-admin") ||
               user.IsInRole("super-admin") ||
               user.IsInRole("SUPER_ADMIN");
    }
}
