'boolean', 'requested_items' => 'array', 'preview' => 'array', 'results' => 'array', 'metadata' => 'array', 'group_mapping' => 'array', 'started_at' => 'datetime', 'completed_at' => 'datetime', ]; public function tenant(): BelongsTo { return $this->belongsTo(Tenant::class); } public function backupSet(): BelongsTo { return $this->belongsTo(BackupSet::class); } // Group mapping helpers public function hasGroupMapping(): bool { return ! empty($this->group_mapping); } public function getMappedGroupId(string $sourceGroupId): ?string { return $this->group_mapping[$sourceGroupId] ?? null; } public function isGroupSkipped(string $sourceGroupId): bool { return $this->group_mapping[$sourceGroupId] === 'SKIP'; } public function getUnmappedGroupIds(array $sourceGroupIds): array { return array_diff($sourceGroupIds, array_keys($this->group_mapping ?? [])); } public function addGroupMapping(string $sourceGroupId, string $targetGroupId): void { $mapping = $this->group_mapping ?? []; $mapping[$sourceGroupId] = $targetGroupId; $this->group_mapping = $mapping; } // Assignment restore outcome helpers public function getAssignmentRestoreOutcomes(): array { return $this->results['assignment_outcomes'] ?? []; } public function getSuccessfulAssignmentsCount(): int { return count(array_filter( $this->getAssignmentRestoreOutcomes(), fn ($outcome) => $outcome['status'] === 'success' )); } public function getFailedAssignmentsCount(): int { return count(array_filter( $this->getAssignmentRestoreOutcomes(), fn ($outcome) => $outcome['status'] === 'failed' )); } public function getSkippedAssignmentsCount(): int { return count(array_filter( $this->getAssignmentRestoreOutcomes(), fn ($outcome) => $outcome['status'] === 'skipped' )); } }