<?php

declare(strict_types=1);

require __DIR__ . '/../includes/bootstrap.php';
require __DIR__ . '/../includes/mvc.php';

$api = \App\Services\ApiService::instance();

// Invalid token probe
$r = $api->request('GET', '/karvipartner/contracts/sign/invalidtoken1234567890123456789012', null, false);
echo "Invalid token:\n" . json_encode($r, JSON_PRETTY_PRINT) . "\n\n";

// Valid token from live API (partner list)
$token = (string)($argv[1] ?? 'bnrtfvwrtnqdbxxk4b6n8sxe0actexs4');
if ($token !== '') {
    $view = $api->request('GET', '/karvipartner/contracts/sign/' . $token, null, false);
    echo "Valid token GET ($token):\n" . json_encode($view, JSON_PRETTY_PRINT) . "\n";
}
