@php
    /** @var bool $shouldShow */
    /** @var ?string $runUrl */
    /** @var ?string $coverageStatus */
    /** @var ?string $fidelity */
    /** @var int $uncoveredTypesCount */
    /** @var list<string> $uncoveredTypes */

    $coverageHasWarnings = in_array(($coverageStatus ?? null), ['warning', 'unproven'], true);
@endphp

<div>
    @if ($shouldShow && $coverageHasWarnings)
        <div class="rounded-lg border border-warning-300 bg-warning-50 p-4 text-warning-900 dark:border-warning-700 dark:bg-warning-950/40 dark:text-warning-100">
            <div class="flex flex-col gap-1">
                <div class="text-sm font-semibold">Baseline compare coverage warnings</div>
                <div class="text-sm">
                    @if (($coverageStatus ?? null) === 'unproven')
                        Coverage proof was missing or unreadable for the last baseline comparison, so findings were suppressed for safety.
                    @else
                        The last baseline comparison had incomplete coverage for {{ (int) $uncoveredTypesCount }} policy {{ Str::plural('type', (int) $uncoveredTypesCount) }}. Findings may be incomplete.
                    @endif

                    @if (filled($fidelity))
                        <span class="ml-1 text-xs text-warning-800 dark:text-warning-300">Fidelity: {{ Str::title($fidelity) }}</span>
                    @endif
                </div>

                @if (! empty($uncoveredTypes))
                    <div class="mt-1 text-xs">
                        Uncovered: {{ implode(', ', array_slice($uncoveredTypes, 0, 6)) }}@if (count($uncoveredTypes) > 6)…@endif
                    </div>
                @endif

                @if (filled($runUrl))
                    <div class="mt-2">
                        <a class="text-sm font-medium text-primary-600 hover:underline dark:text-primary-400" href="{{ $runUrl }}">
                            View run
                        </a>
                    </div>
                @endif
            </div>
        </div>
    @endif
</div>

