using System.Collections.Frozen;
using System.Linq;
using TakeoutSaaS.Application.Identity.Contracts;

namespace TakeoutSaaS.Application.Identity;

internal static class IdentityUserAccess
{
    private static readonly FrozenSet<string> SuperAdminRoleCodes = new[]
    {
        "super-admin",
        "SUPER_ADMIN",
        "PlatformAdmin",
        "platform-admin"
    }.ToFrozenSet(StringComparer.OrdinalIgnoreCase);

    internal static bool IsSuperAdmin(CurrentUserProfile profile)
        => profile.Roles.Any(role => SuperAdminRoleCodes.Contains(role));
}
