namespace GmRelay.DiscordBot.Infrastructure.Discord;

public sealed class DiscordPermissionChecker
{
    private const ulong AdministratorPermission = 0x8;

    public bool CanManageSchedule(
        ulong guildOwnerId,
        ulong userId,
        IEnumerable<ulong> dbManagerUserIds,
        ulong resolvedPermissions)
    {
        if (userId == guildOwnerId)
            return true;

        if (dbManagerUserIds.Contains(userId))
            return true;

        return (resolvedPermissions & AdministratorPermission) == AdministratorPermission;
    }
}

