@php
    $summary = is_array($surface['summary'] ?? null) ? $surface['summary'] : [];
    $availabilityState = is_string($surface['availabilityState'] ?? null) ? (string) $surface['availabilityState'] : 'available';
@endphp

<div data-shared-zone="summary">
    <x-filament::section heading="Normalized diff">
        <div class="flex flex-wrap gap-2">
            @if ($availabilityState === 'unavailable')
                <x-filament::badge color="danger">
                    Unavailable
                </x-filament::badge>
            @elseif ($availabilityState === 'partial')
                <x-filament::badge color="warning">
                    Partial
                </x-filament::badge>
            @endif

            <x-filament::badge color="success">
                {{ (int) ($summary['added'] ?? 0) }} added
            </x-filament::badge>
            <x-filament::badge color="danger">
                {{ (int) ($summary['removed'] ?? 0) }} removed
            </x-filament::badge>
            <x-filament::badge color="warning">
                {{ (int) ($summary['changed'] ?? 0) }} changed
            </x-filament::badge>
        </div>
    </x-filament::section>
</div>