<?php
declare(strict_types=1);

define('CLI_SCRIPT', true);

require __DIR__ . '/../../public/index.php';

use App\Services\CronService;

$job = 'all';
$force = false;

foreach ($argv as $arg) {
    if (str_starts_with($arg, '--job=')) {
        $job = substr($arg, 6);
    }
    if ($arg === '--force') {
        $force = true;
    }
}

echo "Running job: {$job}\n";

$result = match ($job) {
    'submission_deadline_reminders' => CronService::runSubmissionDeadlineReminders($force),
    'review_due_reminders' => CronService::runReviewDueReminders($force),
    'decision_pending_reminders' => CronService::runDecisionPendingReminders($force),
    'camera_ready_reminders' => CronService::runCameraReadyReminders($force),
    default => CronService::runAll($force),
};

print_r($result);
