<?php

use App\Application\Services\Treasury\TreasuryCollectionService;
use Illuminate\Contracts\Console\Kernel;

require __DIR__.'/../../vendor/autoload.php';

$app = require __DIR__.'/../../bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();

$environment = $argv[1] ?? config('gateway.environment');
$result = app(TreasuryCollectionService::class)->syncSubmittedCollections($environment);

echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES).PHP_EOL;
