<?php

declare(strict_types=1);

use Budget\Mailgun;
use Budget\ReminderService;

require __DIR__ . '/../app/bootstrap.php';

$force = in_array('--force', $argv, true);
$service = new ReminderService($pdo, $settings, new Mailgun($settings));
$result = $service->run($force);

echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . PHP_EOL;
exit($result['errors'] === [] ? 0 : 1);
