<?php
$files = [
    'manifest.json',
    'wonderpush-worker-loader.min.js',
    'wonderpush-service-worker.min.js'
];

echo "<h3>Push Notification Health Check</h3>";

// 1. Check HTTPS
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') {
    echo "✅ SSL/HTTPS: Active<br>";
} else {
    echo "❌ SSL/HTTPS: NOT ACTIVE (Push will fail)<br>";
}

// 2. Check Files
foreach ($files as $file) {
    if (file_exists($file)) {
        echo "✅ File Found: $file<br>";
    } else {
        echo "❌ File Missing: $file (Check your root directory)<br>";
    }
}

// 3. Check Manifest Content
if (file_exists('manifest.json')) {
    $manifest = json_decode(file_get_contents('manifest.json'), true);
    if (isset($manifest['display']) && $manifest['display'] === 'standalone') {
        echo "✅ Manifest 'standalone' mode: Configured<br>";
    } else {
        echo "❌ Manifest 'display' mode: NOT set to 'standalone'<br>";
    }
}
?>