<?php echo '<?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">

    {{-- Statik sayfalar --}}
    @foreach($staticPages as $page)
    <url>
        <loc>{{ $domain }}{{ $page['loc'] }}</loc>
        <priority>{{ $page['priority'] }}</priority>
        <changefreq>{{ $page['changefreq'] }}</changefreq>
        <lastmod>{{ now()->toAtomString() }}</lastmod>
    </url>
    @endforeach

    {{-- Türler --}}
    @foreach($genres as $genre)
    <url>
        <loc>{{ $domain }}/genre/{{ $genre->slug }}</loc>
        <priority>0.7</priority>
        <changefreq>weekly</changefreq>
        @if($genre->updated_at)
        <lastmod>{{ $genre->updated_at->toAtomString() }}</lastmod>
        @endif
    </url>
    @endforeach

    {{-- Animeler --}}
    @foreach($animes as $anime)
    <url>
        <loc>{{ $domain }}/anime/{{ $anime->slug }}</loc>
        <priority>{{ $anime->rating >= 8 ? '0.9' : ($anime->rating >= 6 ? '0.8' : '0.6') }}</priority>
        <changefreq>weekly</changefreq>
        @if($anime->updated_at)
        <lastmod>{{ $anime->updated_at->toAtomString() }}</lastmod>
        @endif
        @if($anime->cover_image_url)
        <image:image>
            <image:loc>{{ $anime->cover_image_url }}</image:loc>
            <image:title>{{ htmlspecialchars($anime->title) }}</image:title>
        </image:image>
        @endif
    </url>
    @endforeach

</urlset>
