<?php
declare(strict_types=1);
require __DIR__ . '/bootstrap.php';
[$dir, $file] = storage_paths($config);
$https = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || (($_SERVER['HTTP_X_FORWARDED_PROTO'] ?? '') === 'https');
respond([
    'ok' => true,
    'service' => 'SIAPA Institutional Sync API',
    'version' => 'V41',
    'php' => PHP_VERSION,
    'installed' => is_file(__DIR__ . '/config.override.php'),
    'https' => $https,
    'storage_writable' => is_dir($dir) && is_writable($dir),
    'has_state' => is_file($file),
    'mail_enabled' => !empty($config['mail_enabled']),
    'peer_sync_enabled' => !empty($config['peer_sync_enabled']),
    'time' => gmdate('c'),
]);
