<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <url>
        <loc>https://www.homelandcanary.com/</loc>
        <lastmod><?php echo date('Y-m-d'); ?></lastmod>
        <changefreq>daily</changefreq>
        <priority>1.0</priority>
    </url>
    <url>
        <loc>https://www.homelandcanary.com/propiedades.php</loc>
        <lastmod><?php echo date('Y-m-d'); ?></lastmod>
        <changefreq>daily</changefreq>
        <priority>0.9</priority>
    </url>
    <url>
        <loc>https://www.homelandcanary.com/sobre-nosotros.php</loc>
        <lastmod><?php echo date('Y-m-d'); ?></lastmod>
        <changefreq>monthly</changefreq>
        <priority>0.8</priority>
    </url>
    <url>
        <loc>https://www.homelandcanary.com/contacto.php</loc>
        <lastmod><?php echo date('Y-m-d'); ?></lastmod>
        <changefreq>monthly</changefreq>
        <priority>0.8</priority>
    </url>
    
    <!-- URLs dinámicas de propiedades (esto debería generarse automáticamente en producción) -->
    <?php
    require_once 'config/database.php';
    $conn = getDBConnection();
    $sql = "SELECT id, fecha_modificacion FROM propiedades WHERE activa = 1";
    $result = $conn->query($sql);
    
    if ($result->num_rows > 0) {
        while($row = $result->fetch_assoc()) {
            $lastmod = date('Y-m-d', strtotime($row['fecha_modificacion']));
    ?>
    <url>
        <loc>https://www.homelandcanary.com/detalle-propiedad.php?id=<?php echo $row['id']; ?></loc>
        <lastmod><?php echo $lastmod; ?></lastmod>
        <changefreq>weekly</changefreq>
        <priority>0.7</priority>
    </url>
    <?php
        }
    }
    $conn->close();
    ?>
</urlset>