<?php
require_once __DIR__ . '/includes/config.php';
header('Content-Type: application/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="UTF-8"?>';
$today = date('Y-m-d');
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

  <!-- Core Pages -->
  <url><loc><?= SITE_URL ?>/</loc><lastmod><?= $today ?></lastmod><changefreq>daily</changefreq><priority>1.0</priority></url>
  <url><loc><?= SITE_URL ?>/compare</loc><lastmod><?= $today ?></lastmod><changefreq>weekly</changefreq><priority>0.9</priority></url>
  <url><loc><?= SITE_URL ?>/deals</loc><lastmod><?= $today ?></lastmod><changefreq>daily</changefreq><priority>0.9</priority></url>
  <url><loc><?= SITE_URL ?>/delivery-zones</loc><lastmod><?= $today ?></lastmod><changefreq>weekly</changefreq><priority>0.8</priority></url>
  <url><loc><?= SITE_URL ?>/faq</loc><lastmod><?= $today ?></lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url>
  <url><loc><?= SITE_URL ?>/about</loc><lastmod><?= $today ?></lastmod><changefreq>monthly</changefreq><priority>0.5</priority></url>
  <url><loc><?= SITE_URL ?>/products</loc><lastmod><?= $today ?></lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>

  <!-- Dispensary Profiles -->
  <url><loc><?= SITE_URL ?>/dispensary/dank-city-delivery</loc><lastmod><?= $today ?></lastmod><changefreq>weekly</changefreq><priority>0.9</priority></url>
  <?php foreach ($COMPETITORS as $c): ?>
  <url><loc><?= SITE_URL ?>/dispensary/<?= $c['slug'] ?></loc><lastmod><?= $today ?></lastmod><changefreq>monthly</changefreq><priority>0.6</priority></url>
  <?php endforeach; ?>

  <!-- Delivery Zone Pages -->
  <?php foreach ($DELIVERY_ZONES as $zone): ?>
  <url><loc><?= SITE_URL ?>/delivery/<?= $zone['slug'] ?></loc><lastmod><?= $today ?></lastmod><changefreq>weekly</changefreq><priority>0.8</priority></url>
  <?php endforeach; ?>

  <!-- Product Category Pages -->
  <?php foreach ($PRODUCT_CATEGORIES as $cat): ?>
  <url><loc><?= SITE_URL ?>/products/<?= $cat['slug'] ?></loc><lastmod><?= $today ?></lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
  <?php endforeach; ?>

</urlset>
