$content * @param array $review_metadata */ public function __construct( private readonly int $id, private readonly string $uuid, private readonly string $text_set_key, private readonly string $language_code, private readonly int $version, private readonly string $origin, private readonly string $ruleset_reference, private readonly array $content, private readonly string $content_hash, private readonly string $status, private readonly ?int $effective_from, private readonly ?int $effective_until, private readonly array $review_metadata, private readonly int $created_at, private readonly ?int $published_at ) { if ( '' === trim( $text_set_key ) || '' === trim( $language_code ) || $version <= 0 ) { throw new \InvalidArgumentException( 'Legal text version identity is invalid.' ); } if ( 64 !== strlen( $content_hash ) || 1 !== preg_match( '/^[a-f0-9]{64}$/', $content_hash ) ) { throw new \InvalidArgumentException( 'Legal text content hash must be a lowercase SHA-256 digest.' ); } } public function id(): int { return $this->id; } public function uuid(): string { return $this->uuid; } public function text_set_key(): string { return $this->text_set_key; } public function language_code(): string { return $this->language_code; } public function version(): int { return $this->version; } public function origin(): string { return $this->origin; } public function ruleset_reference(): string { return $this->ruleset_reference; } public function content(): array { return $this->content; } public function content_hash(): string { return $this->content_hash; } public function status(): string { return $this->status; } public function effective_from(): ?int { return $this->effective_from; } public function effective_until(): ?int { return $this->effective_until; } public function review_metadata(): array { return $this->review_metadata; } public function created_at(): int { return $this->created_at; } public function published_at(): ?int { return $this->published_at; } public function is_effective_at( int $timestamp ): bool { return 'PUBLISHED' === strtoupper( $this->status ) && ( null === $this->effective_from || $timestamp >= $this->effective_from ) && ( null === $this->effective_until || $timestamp <= $this->effective_until ); } }