<?php
require __DIR__ . '/../api/bootstrap.php';

use App\Core\Database;
use App\Services\LoyaltyService;

$pdo = Database::connection();
$userIds = $pdo->query('SELECT user_id FROM member_profiles')->fetchAll(PDO::FETCH_COLUMN);
$svc = new LoyaltyService();
foreach ($userIds as $userId) {
    $svc->evaluateBadges((int)$userId);
}
echo 'Pyrk badge job completed for ' . count($userIds) . ' member(s).' . PHP_EOL;
