<x-filament-widgets::widget>
    @php
        $panel = $this->panelData();
    @endphp

    @if ($panel !== null)
        @php
            $isWarning = ($panel['banner_tone'] ?? 'primary') === 'warning';
            $primaryColor = $isWarning ? 'warning' : 'primary';
        @endphp

        <x-dberp.system-update.notice-banner
            :panel="$panel"
            wire:key="system-update-notice-banner-{{ $panel['notice_id'] }}"
        >
            <x-slot:actions>
                <x-filament::button
                    tag="a"
                    :href="$panel['primary_action_url']"
                    :color="$primaryColor"
                    size="sm"
                >
                    {{ $panel['primary_action_label'] }}
                </x-filament::button>

                @if (filled($panel['secondary_action_url'] ?? null))
                    <x-filament::button
                        tag="a"
                        :href="$panel['secondary_action_url']"
                        color="gray"
                        size="sm"
                    >
                        {{ $panel['secondary_action_label'] }}
                    </x-filament::button>
                @endif

                <x-filament::button
                    wire:click="markSystemUpdateNoticeAsRead"
                    color="gray"
                    size="sm"
                >
                    {{ __('dberp.system_update_notice.actions.mark_read') }}
                </x-filament::button>

                <x-filament::button
                    wire:click="dismissSystemUpdateNotice"
                    wire:confirm="{{ __('dberp.system_update_notice.confirm.dismiss') }}"
                    color="gray"
                    outlined
                    size="sm"
                >
                    {{ __('dberp.system_update_notice.actions.dismiss') }}
                </x-filament::button>
            </x-slot:actions>
        </x-dberp.system-update.notice-banner>
    @endif
</x-filament-widgets::widget>
