@php $state = $getState() ?? []; $state = is_array($state) ? $state : []; $preview = is_array($state['preview'] ?? null) ? $state['preview'] : $state; $previewIntegrity = is_array($state['previewIntegrity'] ?? null) ? $state['previewIntegrity'] : []; $checksIntegrity = is_array($state['checksIntegrity'] ?? null) ? $state['checksIntegrity'] : []; $executionSafetySnapshot = is_array($state['executionSafetySnapshot'] ?? null) ? $state['executionSafetySnapshot'] : []; $scopeBasis = is_array($state['scopeBasis'] ?? null) ? $state['scopeBasis'] : []; $integritySpec = \App\Support\Badges\BadgeRenderer::spec( \App\Support\Badges\BadgeDomain::RestorePreviewDecision, $previewIntegrity['state'] ?? 'not_generated' ); $checksSpec = \App\Support\Badges\BadgeRenderer::spec( \App\Support\Badges\BadgeDomain::RestoreCheckSeverity, $checksIntegrity['state'] ?? 'not_run' ); $recoveryBoundary = \App\Support\RestoreSafety\RestoreSafetyCopy::recoveryBoundary( is_string($executionSafetySnapshot['follow_up_boundary'] ?? null) ? $executionSafetySnapshot['follow_up_boundary'] : 'preview_only_no_execution_proven' ); $actionPresentation = static function (array $item): array { $action = is_string($item['action'] ?? null) ? $item['action'] : null; return match ($action) { 'create' => ['label' => 'Will create', 'color' => 'success'], 'update' => ['label' => 'Will update existing', 'color' => 'info'], default => ['label' => \Illuminate\Support\Str::headline((string) ($action ?? 'action')), 'color' => 'gray'], }; }; $foundationItems = collect($preview)->filter(function ($item) { return is_array($item) && array_key_exists('decision', $item) && array_key_exists('sourceId', $item); }); $policyItems = collect($preview)->reject(function ($item) { return is_array($item) && array_key_exists('decision', $item) && array_key_exists('sourceId', $item); }); @endphp @if (empty($preview))

No preview has been generated yet.

@else
{{ $integritySpec->label }} {{ $checksSpec->label }}
What the preview proves
{{ $previewIntegrity['display_summary'] ?? 'Preview basis is unavailable.' }}
What this record does not prove
{{ $recoveryBoundary }}
@if (($scopeBasis['fingerprint'] ?? null) !== null)
Scope mode: {{ $scopeBasis['scope_mode'] ?? 'all' }} @if (($scopeBasis['selected_item_ids'] ?? []) !== []) • selected items: {{ count($scopeBasis['selected_item_ids']) }} @endif
@endif
@if ($foundationItems->isNotEmpty())
Foundations
@foreach ($foundationItems as $item) @php $decision = $item['decision'] ?? 'mapped_existing'; $foundationIsPreviewOnly = ($item['reason'] ?? null) === 'preview_only' || ($item['restore_mode'] ?? null) === 'preview-only' || $decision === 'dry_run'; $decisionSpec = $foundationIsPreviewOnly ? \App\Support\Badges\BadgeRenderer::spec(\App\Support\Badges\BadgeDomain::PolicyRestoreMode, 'preview_only') : \App\Support\Badges\BadgeRenderer::spec(\App\Support\Badges\BadgeDomain::RestorePreviewDecision, $decision); $foundationReason = $item['reason'] ?? null; if ($foundationReason === 'preview_only') { $foundationReason = 'Preview only. This foundation type is not applied during execution.'; } @endphp
{{ $item['sourceName'] ?? $item['sourceId'] ?? 'Foundation' }} {{ $decisionSpec->label }}
{{ $item['type'] ?? 'foundation' }}
@if (! empty($item['targetName']))
Target: {{ $item['targetName'] }}
@endif @if (! empty($foundationReason))
{{ $foundationReason }}
@endif
@endforeach
@endif @if ($policyItems->isNotEmpty())
Policies
@foreach ($policyItems as $item) @php $restoreMode = $item['restore_mode'] ?? null; $actionState = $actionPresentation(is_array($item) ? $item : []); @endphp
{{ $item['policy_identifier'] ?? 'Policy' }}
@if ($restoreMode === 'preview-only') @php $restoreModeSpec = \App\Support\Badges\BadgeRenderer::spec(\App\Support\Badges\BadgeDomain::PolicyRestoreMode, $restoreMode); @endphp {{ $restoreModeSpec->label }} @endif {{ $actionState['label'] }}
{{ $item['policy_type'] ?? 'type' }} • {{ $item['platform'] ?? 'platform' }}
@if (! empty($item['validation_warning']))
{{ $item['validation_warning'] }}
@endif @if (! empty($item['compliance_action_warning']))
{{ $item['compliance_action_warning'] }}
@endif @if (! empty($item['compliance_action_summary']) && is_array($item['compliance_action_summary'])) @php $summary = $item['compliance_action_summary']; $missingTemplates = $item['compliance_action_missing_templates'] ?? []; $total = (int) ($summary['total'] ?? 0); $missing = (int) ($summary['missing'] ?? 0); @endphp
Compliance notifications: {{ $total }} total • {{ $missing }} missing
@if (! empty($missingTemplates) && is_array($missingTemplates))
Missing notification templates
@foreach ($missingTemplates as $templateId)
{{ $templateId }}
@endforeach
@endif @endif
@endforeach
@endif
@endif