<?php
declare(strict_types=1);
require_once __DIR__ . '/../../src/bootstrap.php';

header('Content-Type: application/json; charset=utf-8');

$sfu = cfg('sfu', []);
$enabled = (bool) ($sfu['enabled'] ?? false);

echo json_encode([
    'ok' => true,
    'sfu' => [
        'enabled' => $enabled,
        'status' => $enabled ? 'preview' : 'disabled',
        'signaling_url' => $enabled ? (string) ($sfu['signaling_url'] ?? '') : '',
        'janus_url' => $enabled ? (string) ($sfu['janus_url'] ?? '') : '',
    ],
], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
