<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

  <!-- ── Core pages ── -->
  <url>
    <loc>https://yadi.app/</loc>
    <changefreq>daily</changefreq>
    <priority>1.0</priority>
  </url>

  <url>
    <loc>https://yadi.app/sell</loc>
    <changefreq>monthly</changefreq>
    <priority>1.0</priority>
  </url>


  <!-- ── Auth ── -->
  <url>
    <loc>https://yadi.app/login</loc>
    <changefreq>monthly</changefreq>
    <priority>0.4</priority>
  </url>
  <url>
    <loc>https://yadi.app/register</loc>
    <changefreq>monthly</changefreq>
    <priority>0.4</priority>
  </url>

  <!-- ── Legal ── -->
  <url>
    <loc>https://yadi.app/terms</loc>
    <changefreq>yearly</changefreq>
    <priority>0.3</priority>
  </url>

  <!--
    Dynamic pages (events + spaces) are generated server-side.
    Reference them via a sitemap index at: https://yadi.app/sitemap-index.xml

    sitemap-index.xml example:
    ───────────────────────────────────────────────────────────────────────────
    <?xml version="1.0" encoding="UTF-8"?>
    <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
      <sitemap>
        <loc>https://yadi.app/sitemap.xml</loc>
      </sitemap>
      <sitemap>
        <loc>https://yadi.app/sitemap-events.xml</loc>
      </sitemap>
      <sitemap>
        <loc>https://yadi.app/sitemap-spaces.xml</loc>
      </sitemap>
    </sitemapindex>

    Django view — sitemap-events.xml:
    ───────────────────────────────────────────────────────────────────────────
    from django.http import HttpResponse
    from events.models import Event

    def events_sitemap(request):
        events = Event.objects.filter(is_published=True).values('id', 'updated_at')
        xml  = '<?xml version="1.0" encoding="UTF-8"?>'
        xml += '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'
        for e in events:
            xml += f'<url><loc>https://yadi.app/event/{e["id"]}</loc>'
            xml += f'<lastmod>{e["updated_at"].date()}</lastmod>'
            xml += '<changefreq>weekly</changefreq><priority>0.8</priority></url>'
        xml += '</urlset>'
        return HttpResponse(xml, content_type='application/xml')

    Django view — sitemap-spaces.xml:
    ───────────────────────────────────────────────────────────────────────────
    from django.http import HttpResponse
    from spaces.models import Space

    def spaces_sitemap(request):
        spaces = Space.objects.filter(is_published=True).values('slug', 'updated_at')
        xml  = '<?xml version="1.0" encoding="UTF-8"?>'
        xml += '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'
        for s in spaces:
            xml += f'<url><loc>https://yadi.app/space/{s["slug"]}</loc>'
            xml += f'<lastmod>{s["updated_at"].date()}</lastmod>'
            xml += '<changefreq>weekly</changefreq><priority>0.7</priority></url>'
        xml += '</urlset>'
        return HttpResponse(xml, content_type='application/xml')
  -->

</urlset>