<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
  
  <!-- Homepage - highest priority, updated weekly -->
  <url>
    <loc>https://lemontreeboran.com.au/</loc>
    <lastmod>2026-06-25</lastmod>
    <changefreq>weekly</changefreq>
    <priority>1.0</priority>
  </url>

  <!-- Cattle Catalogue - updated daily as inventory changes -->
  <url>
    <loc>https://lemontreeboran.com.au/cows</loc>
    <lastmod>2026-06-25</lastmod>
    <changefreq>daily</changefreq>
    <priority>0.95</priority>
  </url>

  <!-- About Us Page - updated monthly -->
  <url>
    <loc>https://lemontreeboran.com.au/about</loc>
    <lastmod>2026-06-25</lastmod>
    <changefreq>monthly</changefreq>
    <priority>0.85</priority>
  </url>

  <!-- Contact Page - updated monthly -->
  <url>
    <loc>https://lemontreeboran.com.au/contact</loc>
    <lastmod>2026-06-25</lastmod>
    <changefreq>monthly</changefreq>
    <priority>0.80</priority>
  </url>

  <!-- Sample Individual Cattle Listings -->
  <!-- Add dynamic cattle entries here - use actual cattle IDs from your DynamoDB table -->
  <!-- Format: https://lemontreeboran.com.au/cow/{cattle-id} -->
  <!-- Update this file weekly when new cattle are added or existing ones are modified -->

  <!--
    PRODUCTION NOTE:
    
    For best SEO results, generate this sitemap dynamically from your DynamoDB table:
    
    Option 1: Static File (Current)
    - Manually update this file when you add/modify cattle
    - Update <lastmod> date when file changes
    
    Option 2: Dynamic Generation (Recommended)
    - Create a Node.js Lambda function or API endpoint
    - Query DynamoDB cows table
    - Generate XML with all cattle entries
    - Include S3 image URLs
    - Cache for 24 hours
    - Regenerate on cattle database updates
    
    Example Dynamic Implementation:
    
    // In handlers/src/routes/sitemap.ts
    export default async function sitemapRoutes(fastify: FastifyInstance) {
      fastify.get('/sitemap.xml', async (request, reply) => {
        // Query DynamoDB cows table
        const cows = await ddbDocClient.send(
          new ScanCommand({ TableName: cowsTable })
        );
        
        // Build XML
        let xml = '<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n';
        
        // Add static pages
        xml += '<url><loc>https://lemontreeboran.com.au/</loc></url>\n';
        xml += '<url><loc>https://lemontreeboran.com.au/cows</loc></url>\n';
        
        // Add cattle entries
        if (cows.Items) {
          cows.Items.forEach((cow: any) => {
            xml += `<url><loc>https://lemontreeboran.com.au/cow/${cow.id}</loc><lastmod>${new Date(cow.updatedAt).toISOString().split('T')[0]}</lastmod></url>\n`;
          });
        }
        
        xml += '</urlset>';
        reply.type('application/xml');
        return xml;
      });
    }
    
    Then in CloudFront:
    - Route /sitemap.xml to your Lambda origin
    - Set TTL to 86400 (24 hours)
    - Cache based on cattle update frequency
  -->

</urlset>
