<?php
// api/latest.php
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');

// В реальности здесь будет подключение к базе данных или внешним источникам
// Сейчас используем демо-данные

$demo_data = [
    'security_index' => 2.8,
    'aal_level' => 4,
    'timestamp' => date('c'),
    'time_to_aa3' => 12.5,
    'signal_detection_time' => 42,
    'components' => [
        'pizza' => ['raw' => 2.1, 'score' => 2.6],
        'oil' => ['raw' => 85, 'score' => 0.8],
        'media' => ['raw' => 1200, 'score' => 1.5],
        'navy' => ['raw' => 2, 'score' => 2.0],
        'vip' => ['raw' => 8, 'score' => 2.0],
        'gov' => ['raw' => 2, 'score' => 2.5],
        'gold' => ['raw' => 45, 'score' => 0.9],
        'cyber' => ['raw' => 2, 'score' => 2.5],
        'energy' => ['raw' => 60, 'score' => 0.4],
        'social' => ['raw' => 2, 'score' => 2.5]
    ]
];

echo json_encode($demo_data, JSON_PRETTY_PRINT);
?>