stateFamily, [ self::STATE_POSITIVE, self::STATE_CAUTION, self::STATE_STALE, self::STATE_ACTION_REQUIRED, self::STATE_UNAVAILABLE, self::STATE_IN_PROGRESS, ], true)) { throw new InvalidArgumentException('Unsupported baseline summary state family: '.$this->stateFamily); } if (trim($this->headline) === '') { throw new InvalidArgumentException('Baseline summary assessments require a headline.'); } if (! in_array($this->evidenceImpact, [ self::EVIDENCE_NONE, self::EVIDENCE_COVERAGE_WARNING, self::EVIDENCE_EVIDENCE_GAP, self::EVIDENCE_STALE_RESULT, self::EVIDENCE_SUPPRESSED_OUTPUT, self::EVIDENCE_UNAVAILABLE, ], true)) { throw new InvalidArgumentException('Unsupported baseline summary evidence impact: '.$this->evidenceImpact); } if (! in_array($this->nextAction['target'] ?? null, [ self::NEXT_TARGET_LANDING, self::NEXT_TARGET_FINDINGS, self::NEXT_TARGET_RUN, self::NEXT_TARGET_NONE, ], true)) { throw new InvalidArgumentException('Unsupported baseline summary next-action target.'); } if (trim((string) ($this->nextAction['label'] ?? '')) === '') { throw new InvalidArgumentException('Baseline summary assessments require a next-action label.'); } if ($this->positiveClaimAllowed && $this->stateFamily !== self::STATE_POSITIVE) { throw new InvalidArgumentException('Positive claim eligibility must resolve to the positive summary state.'); } } public function nextActionLabel(): string { return $this->nextAction['label']; } public function nextActionTarget(): string { return $this->nextAction['target']; } /** * @return array{ * stateFamily: string, * headline: string, * supportingMessage: ?string, * tone: string, * positiveClaimAllowed: bool, * trustworthinessLevel: string, * evaluationResult: string, * evidenceImpact: string, * findingsVisibleCount: int, * highSeverityCount: int, * nextAction: array{label: string, target: string}, * lastComparedLabel: ?string, * reasonCode: ?string * } */ public function toArray(): array { return [ 'stateFamily' => $this->stateFamily, 'headline' => $this->headline, 'supportingMessage' => $this->supportingMessage, 'tone' => $this->tone, 'positiveClaimAllowed' => $this->positiveClaimAllowed, 'trustworthinessLevel' => $this->trustworthinessLevel, 'evaluationResult' => $this->evaluationResult, 'evidenceImpact' => $this->evidenceImpact, 'findingsVisibleCount' => $this->findingsVisibleCount, 'highSeverityCount' => $this->highSeverityCount, 'nextAction' => $this->nextAction, 'lastComparedLabel' => $this->lastComparedLabel, 'reasonCode' => $this->reasonCode, ]; } }