<?php

declare(strict_types=1);

namespace App\Support\RestoreSafety;

final readonly class RestoreExecutionSafetySnapshot
{
    public function __construct(
        public string $evaluatedAt,
        public string $scopeFingerprint,
        public string $previewState,
        public string $checksState,
        public string $safetyState,
        public int $blockingCount,
        public int $warningCount,
        public ?string $primaryIssueCode,
        public string $followUpBoundary,
    ) {}

    /**
     * @return array{
     *     evaluated_at: string,
     *     scope_fingerprint: string,
     *     preview_state: string,
     *     checks_state: string,
     *     safety_state: string,
     *     blocking_count: int,
     *     warning_count: int,
     *     primary_issue_code: ?string,
     *     follow_up_boundary: string
     * }
     */
    public function toArray(): array
    {
        return [
            'evaluated_at' => $this->evaluatedAt,
            'scope_fingerprint' => $this->scopeFingerprint,
            'preview_state' => $this->previewState,
            'checks_state' => $this->checksState,
            'safety_state' => $this->safetyState,
            'blocking_count' => $this->blockingCount,
            'warning_count' => $this->warningCount,
            'primary_issue_code' => $this->primaryIssueCode,
            'follow_up_boundary' => $this->followUpBoundary,
        ];
    }
}
