<?php

declare(strict_types=1);

require dirname(__DIR__) . '/app/bootstrap.php';

$config = require APP_PATH . '/config.php';
$manager = new \App\Services\License\LicenseManager($config);
$payload = [
    'state' => license_state(),
    'fingerprint' => \App\Services\License\ServerFingerprint::value($config),
    'license_path' => APP_BASE_PATH . '/storage/license/license.json',
    'dev_override_path' => APP_BASE_PATH . '/storage/license/dev-override.json',
    'public_key_path' => APP_BASE_PATH . '/storage/license/public.key',
    'template' => $manager->activationTemplate(),
    'activation_request_template' => $manager->activationRequestTemplate(),
    'developer_console_enabled' => $manager->isDeveloperConsoleEnabled(),
    'dev_override_template' => $manager->devOverrideTemplate(),
    'signing_payload' => $manager->signingPayloadTemplate(),
];
if (PHP_SAPI === 'cli') {
    echo json_encode($payload, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . PHP_EOL;
    exit;
}
header('Content-Type: application/json; charset=utf-8');
echo json_encode($payload, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
