<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:news="http://www.google.com/schemas/sitemap-news/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">
    
    <!-- Page d'accueil -->
    <url>
        <loc><?= siteUrl() ?></loc>
        <lastmod><?= date('Y-m-d') ?></lastmod>
        <changefreq>daily</changefreq>
        <priority>1.0</priority>
    </url>
    
    <!-- Page de musique -->
    <url>
        <loc><?= siteUrl('music.php') ?></loc>
        <lastmod><?= date('Y-m-d') ?></lastmod>
        <changefreq>weekly</changefreq>
        <priority>0.9</priority>
    </url>
    
    <!-- Page de vidéos -->
    <url>
        <loc><?= siteUrl('videos.php') ?></loc>
        <lastmod><?= date('Y-m-d') ?></lastmod>
        <changefreq>weekly</changefreq>
        <priority>0.8</priority>
    </url>
    
    <!-- Boutique -->
    <url>
        <loc><?= siteUrl('shop.php') ?></loc>
        <lastmod><?= date('Y-m-d') ?></lastmod>
        <changefreq>weekly</changefreq>
        <priority>0.8</priority>
    </url>
    
    <!-- Blog -->
    <url>
        <loc><?= siteUrl('blog.php') ?></loc>
        <lastmod><?= date('Y-m-d') ?></lastmod>
        <changefreq>weekly</changefreq>
        <priority>0.8</priority>
    </url>
    
    <!-- À propos -->
    <url>
        <loc><?= siteUrl('about.php') ?></loc>
        <lastmod><?= date('Y-m-d', strtotime('-1 month')) ?></lastmod>
        <changefreq>monthly</changefreq>
        <priority>0.7</priority>
    </url>
    
    <!-- Contact -->
    <url>
        <loc><?= siteUrl('contact.php') ?></loc>
        <lastmod><?= date('Y-m-d', strtotime('-1 month')) ?></lastmod>
        <changefreq>monthly</changefreq>
        <priority>0.7</priority>
    </url>
    
    <!-- Politique de confidentialité -->
    <url>
        <loc><?= siteUrl('politique-confidentialite.php') ?></loc>
        <lastmod><?= date('Y-m-d', strtotime('-3 months')) ?></lastmod>
        <changefreq>monthly</changefreq>
        <priority>0.5</priority>
    </url>
    
    <!-- Gestion des cookies -->
    <url>
        <loc><?= siteUrl('cookies.php') ?></loc>
        <lastmod><?= date('Y-m-d', strtotime('-3 months')) ?></lastmod>
        <changefreq>monthly</changefreq>
        <priority>0.5</priority>
    </url>
    
    <!-- Pages dynamiques (à remplir avec les données de la base de données) -->
    <?php
    // Exemple pour les pistes musicales
    $tracks = []; // Récupérer les pistes depuis la base de données
    foreach ($tracks as $track) {
        echo "<url>\n";
        echo "    <loc>" . siteUrl('track/' . $track['slug']) . "</loc>\n";
        echo "    <lastmod>" . date('Y-m-d', strtotime($track['updated_at'])) . "</lastmod>\n";
        echo "    <changefreq>weekly</changefreq>\n";
        echo "    <priority>0.8</priority>\n";
        echo "</url>\n";
    }
    
    // Exemple pour les vidéos
    $videos = []; // Récupérer les vidéos depuis la base de données
    foreach ($videos as $video) {
        echo "<url>\n";
        echo "    <loc>" . siteUrl('video/' . $video['slug']) . "</loc>\n";
        echo "    <lastmod>" . date('Y-m-d', strtotime($video['published_at'])) . "</lastmod>\n";
        echo "    <changefreq>monthly</changefreq>\n";
        echo "    <priority>0.7</priority>\n";
        echo "</url>\n";
    }
    
    // Exemple pour les articles de blog
    $posts = []; // Récupérer les articles depuis la base de données
    foreach ($posts as $post) {
        echo "<url>\n";
        echo "    <loc>" . siteUrl('blog/' . $post['slug']) . "</loc>\n";
        echo "    <lastmod>" . date('Y-m-d', strtotime($post['updated_at'])) . "</lastmod>\n";
        echo "    <changefreq>monthly</changefreq>\n";
        echo "    <priority>0.6</priority>\n";
        echo "    <news:news>\n";
        echo "        <news:publication>\n";
        echo "            <news:name>" . htmlspecialchars($site_name) . "</news:name>\n";
        echo "            <news:language>fr</news:language>\n";
        echo "        </news:publication>\n";
        echo "        <news:publication_date>" . date('Y-m-d', strtotime($post['published_at'])) . "</news:publication_date>\n";
        echo "        <news:title>" . htmlspecialchars($post['title']) . "</news:title>\n";
        echo "    </news:news>\n";
        echo "</url>\n";
    }
    ?>
    
</urlset>
