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

    {{-- Homepage --}}
    <url>
        <loc>{{ url('/') }}</loc>
        <changefreq>daily</changefreq>
        <priority>1.0</priority>
    </url>

    {{-- Marketplace listing --}}
    <url>
        <loc>{{ route('items.index') }}</loc>
        <changefreq>hourly</changefreq>
        <priority>0.9</priority>
    </url>

    {{-- Categories index --}}
    <url>
        <loc>{{ route('categories.index') }}</loc>
        <changefreq>weekly</changefreq>
        <priority>0.8</priority>
    </url>

    {{-- Individual categories --}}
    @foreach($categories as $category)
    <url>
        <loc>{{ route('categories.show', $category->id) }}</loc>
        <lastmod>{{ $category->updated_at->toAtomString() }}</lastmod>
        <changefreq>daily</changefreq>
        <priority>0.7</priority>
    </url>
    @endforeach

    {{-- Individual items --}}
    @foreach($items as $item)
    <url>
        <loc>{{ route('items.show', $item->id) }}</loc>
        <lastmod>{{ $item->updated_at->toAtomString() }}</lastmod>
        <changefreq>weekly</changefreq>
        <priority>0.6</priority>
    </url>
    @endforeach

</urlset>
