<?php
require_once __DIR__ . '/../app/Core.php';
require_once __DIR__ . '/../app/services.php';
require_once __DIR__ . '/../app/models/QueueJob.php';
require_once __DIR__ . '/../app/models/Campaign.php';

date_default_timezone_set(config('app.timezone', 'America/Chicago'));
$queue = new QueueJob();
$campaigns = (new Campaign())->due();
$count = 0;
foreach ($campaigns as $campaign) {
    $queue->create('campaign_process', ['campaign_id' => (int)$campaign['id']]);
    $count++;
}
echo 'Queued campaign jobs: ' . $count . PHP_EOL;
