<?xml version="1.0" encoding="UTF-8"?>
<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">

    <!-- Static Pages -->
    <url>
        <loc>https://dryzoneprotectors.com/</loc>
        <lastmod><?php echo date('Y-m-d'); ?></lastmod>
        <changefreq>weekly</changefreq>
        <priority>1.0</priority>
    </url>
    <url>
        <loc>https://dryzoneprotectors.com/about</loc>
        <lastmod><?php echo date('Y-m-d'); ?></lastmod>
        <changefreq>monthly</changefreq>
        <priority>0.8</priority>
    </url>
    <url>
        <loc>https://dryzoneprotectors.com/services</loc>
        <lastmod><?php echo date('Y-m-d'); ?></lastmod>
        <changefreq>monthly</changefreq>
        <priority>0.9</priority>
    </url>
    <url>
        <loc>https://dryzoneprotectors.com/contact</loc>
        <lastmod><?php echo date('Y-m-d'); ?></lastmod>
        <changefreq>monthly</changefreq>
        <priority>0.7</priority>
    </url>
    <url>
        <loc>https://dryzoneprotectors.com/privacy-policy</loc>
        <lastmod><?php echo date('Y-m-d'); ?></lastmod>
        <changefreq>yearly</changefreq>
        <priority>0.3</priority>
    </url>

    <!-- Service Pages -->
    <?php
    $services = json_decode(file_get_contents(__DIR__ . '/data/services.json'), true);
    if (is_array($services)) {
        foreach ($services as $service) {
            $slug = $service['slug'] ?? '';
            if ($slug) {
                echo '    <url>' . "\n";
                echo '        <loc>https://dryzoneprotectors.com/service/' . htmlspecialchars($slug) . '</loc>' . "\n";
                echo '        <lastmod>' . date('Y-m-d') . '</lastmod>' . "\n";
                echo '        <changefreq>monthly</changefreq>' . "\n";
                echo '        <priority>0.8</priority>' . "\n";
                echo '    </url>' . "\n";
            }
        }
    }
    ?>

    <!-- Blog Pages -->
    <?php
    $blogs = json_decode(file_get_contents(__DIR__ . '/data/blogs.json'), true);
    if (is_array($blogs)) {
        foreach ($blogs as $blog) {
            $slug = $blog['slug'] ?? '';
            if ($slug) {
                $date = isset($blog['publish_date']) ? $blog['publish_date'] : date('Y-m-d');
                echo '    <url>' . "\n";
                echo '        <loc>https://dryzoneprotectors.com/' . htmlspecialchars($slug) . '</loc>' . "\n";
                echo '        <lastmod>' . date('Y-m-d', strtotime($date)) . '</lastmod>' . "\n";
                echo '        <changefreq>monthly</changefreq>' . "\n";
                echo '        <priority>0.6</priority>' . "\n";
                echo '    </url>' . "\n";
            }
        }
    }
    ?>

</urlset>