<?php
/**
 * sitemap.xml — Dynamic sitemap for qrcode.balthroplogic.com
 * 
 * Outputs a valid XML sitemap. Static pages are hardcoded.
 * Dynamic QR analytics pages for paid dynamic codes are included
 * only if they are publicly accessible (which they aren't — so
 * we skip them and only list the core marketing/tool pages).
 *
 * Access: https://qrcode.balthroplogic.com/sitemap.xml
 * Submit to: Google Search Console, Bing Webmaster Tools
 */

declare(strict_types=1);

header('Content-Type: application/xml; charset=utf-8');
header('Cache-Control: public, max-age=86400'); // Cache 24 hours

$baseUrl = 'https://qrcode.balthroplogic.com';
$today   = date('Y-m-d');

$pages = [
    // URL, lastmod, changefreq, priority
    ['/',              $today, 'weekly',  '1.0'],
    ['/builder.php',   $today, 'weekly',  '0.9'],
    ['/account.php',   $today, 'monthly', '0.6'],
    ['/contact.php',   $today, 'monthly', '0.7'],
    ['/account-recovery.php', $today, 'monthly', '0.4'],
];

echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
        http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<?php foreach ($pages as [$path, $lastmod, $changefreq, $priority]): ?>
  <url>
    <loc><?= htmlspecialchars($baseUrl . $path, ENT_QUOTES, 'UTF-8') ?></loc>
    <lastmod><?= $lastmod ?></lastmod>
    <changefreq><?= $changefreq ?></changefreq>
    <priority><?= $priority ?></priority>
  </url>
<?php endforeach; ?>
</urlset>
