<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>{{ config('app.name', 'ONOX') }} Sistem Durumu</title>
        <link>{{ url('/status') }}</link>
        <description>ONOX hosting kontrol paneli servis olayları ve bakım duyuruları.</description>
        <language>tr</language>
        <lastBuildDate>{{ now()->toRssString() }}</lastBuildDate>
        <atom:link href="{{ url('/status.rss') }}" rel="self" type="application/rss+xml" />

        @forelse($incidents as $incident)
        <item>
            <title>{{ htmlspecialchars($incident->title) }}</title>
            <link>{{ url('/status') }}</link>
            <guid isPermaLink="false">incident-{{ $incident->id }}</guid>
            <pubDate>{{ $incident->started_at->toRssString() }}</pubDate>
            <description><![CDATA[
                <p><strong>Durum:</strong>
                    @switch($incident->status)
                        @case('investigating') İnceleniyor @break
                        @case('identified')    Tespit Edildi @break
                        @case('monitoring')    İzleniyor @break
                        @case('resolved')      Çözüldü @break
                        @case('postmortem')    Olay Raporu @break
                        @default               {{ $incident->status }}
                    @endswitch
                </p>
                <p><strong>Etki:</strong>
                    @switch($incident->impact)
                        @case('none')     Yok @break
                        @case('minor')    Küçük @break
                        @case('major')    Büyük @break
                        @case('critical') Kritik @break
                        @default          {{ $incident->impact }}
                    @endswitch
                </p>
                @if($incident->description)
                <p>{{ $incident->description }}</p>
                @endif
                @if($incident->resolved_at)
                <p><strong>Çözüm Zamanı:</strong> {{ $incident->resolved_at->format('d.m.Y H:i') }} UTC</p>
                @endif
            ]]></description>
        </item>
        @empty
        <item>
            <title>Tüm sistemler operasyonel</title>
            <link>{{ url('/status') }}</link>
            <guid isPermaLink="false">no-incidents</guid>
            <pubDate>{{ now()->toRssString() }}</pubDate>
            <description>Son 30 günde aktif olay bulunmamaktadır.</description>
        </item>
        @endforelse
    </channel>
</rss>
