$input_manifest */ public function __construct( private readonly int $id, private readonly string $uuid, private readonly int $order_id, private readonly int $snapshot_id, private readonly string $document_type, private readonly int $revision, private readonly int $template_version_id, private readonly int $legal_text_version_id, private readonly int $terms_version_id, private readonly string $language_code, private readonly string $storage_key, private readonly string $mime_type, private readonly string $file_hash, private readonly int $file_size, private readonly string $status, private readonly ?int $supersedes_document_id, private readonly string $snapshot_hash, private readonly string $template_hash, private readonly string $legal_text_hash, private readonly string $terms_hash, private readonly array $input_manifest, private readonly string $input_hash, private readonly int $sealed_at, private readonly int $created_at ) { if ( $order_id <= 0 || $snapshot_id <= 0 || $revision <= 0 || $template_version_id <= 0 || $legal_text_version_id <= 0 || $terms_version_id <= 0 ) { throw new \InvalidArgumentException( 'Document revision identity is invalid.' ); } foreach ( array( $file_hash, $snapshot_hash, $template_hash, $legal_text_hash, $terms_hash, $input_hash ) as $hash ) { if ( 64 !== strlen( $hash ) || 1 !== preg_match( '/^[a-f0-9]{64}$/', $hash ) ) { throw new \InvalidArgumentException( 'Document integrity hashes must be lowercase SHA-256 digests.' ); } } if ( $file_size <= 0 || $sealed_at <= 0 ) { throw new \InvalidArgumentException( 'Document revision must be sealed with a non-empty file.' ); } if ( 'SEALED' !== strtoupper( trim( $status ) ) ) { throw new \InvalidArgumentException( 'Document revision status must be SEALED.' ); } } public function id(): int { return $this->id; } public function uuid(): string { return $this->uuid; } public function order_id(): int { return $this->order_id; } public function snapshot_id(): int { return $this->snapshot_id; } public function document_type(): string { return $this->document_type; } public function revision(): int { return $this->revision; } public function template_version_id(): int { return $this->template_version_id; } public function legal_text_version_id(): int { return $this->legal_text_version_id; } public function terms_version_id(): int { return $this->terms_version_id; } public function language_code(): string { return $this->language_code; } public function storage_key(): string { return $this->storage_key; } public function mime_type(): string { return $this->mime_type; } public function file_hash(): string { return $this->file_hash; } public function file_size(): int { return $this->file_size; } public function status(): string { return $this->status; } public function supersedes_document_id(): ?int { return $this->supersedes_document_id; } public function snapshot_hash(): string { return $this->snapshot_hash; } public function template_hash(): string { return $this->template_hash; } public function legal_text_hash(): string { return $this->legal_text_hash; } public function terms_hash(): string { return $this->terms_hash; } public function input_manifest(): array { return $this->input_manifest; } public function input_hash(): string { return $this->input_hash; } public function sealed_at(): int { return $this->sealed_at; } public function created_at(): int { return $this->created_at; } public function is_persisted(): bool { return $this->id > 0; } }