<?php
header('Content-Type: application/manifest+json');
require_once __DIR__ . '/include/config.php';

$name = $site_data['web_name'] ?? 'VTU Platform';
$short_name = $site_data['web_name'] ?? 'VTU';
$start_url = $site_data['web_url'] ?? '/';
$icon = !empty($site_data['logo_url']) ? $site_data['logo_url'] : $start_url . '/images/softbills.png';

$manifest = [
    'name' => $name,
    'short_name' => $short_name,
    'description' => $name . ' - Virtual Numbers, Social Media Growth, Airtime, Data & Bill Payments',
    'start_url' => $start_url . '/user/dashboard',
    'scope' => $start_url . '/',
    'display' => 'standalone',
    'orientation' => 'portrait',
    'theme_color' => '#4D148C',
    'background_color' => '#ffffff',
    'categories' => ['finance', 'utilities', 'social'],
    'icons' => [
        [
            'src' => $icon,
            'sizes' => '192x192',
            'type' => 'image/png',
            'purpose' => 'any maskable'
        ],
        [
            'src' => $icon,
            'sizes' => '512x512',
            'type' => 'image/png',
            'purpose' => 'any maskable'
        ]
    ],
    'screenshots' => [],
    'shortcuts' => [
        [
            'name' => 'Fund Wallet',
            'short_name' => 'Fund',
            'url' => $start_url . '/user/fund-wallet',
            'icons' => [['src' => $icon, 'sizes' => '192x192']]
        ],
        [
            'name' => 'Buy Data',
            'short_name' => 'Data',
            'url' => $start_url . '/user/buy-data',
            'icons' => [['src' => $icon, 'sizes' => '192x192']]
        ],
        [
            'name' => 'Social Boost',
            'short_name' => 'Boost',
            'url' => $start_url . '/user/boost',
            'icons' => [['src' => $icon, 'sizes' => '192x192']]
        ]
    ]
];

echo json_encode($manifest, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
