$inventoryItemId], tenant: $tenant) : null; return new self( targetLabel: $label, displayName: $displayName, maskedId: $maskedId, resolved: true, linkUrl: $url, foundationType: $foundationType, reasonUnresolved: null, badgeText: "{$label}: {$displayName} ({$maskedId})", ); } public static function externalReference(string $targetId, ?string $foundationType = null): self { $maskedId = static::mask($targetId); $label = $foundationType ? "External ref ({$foundationType})" : 'External reference'; return new self( targetLabel: $label, displayName: null, maskedId: $maskedId, resolved: false, linkUrl: null, foundationType: $foundationType, reasonUnresolved: 'unsupported_foundation_type', badgeText: "{$label}: {$maskedId}", ); } public function toArray(): array { return [ 'target_label' => $this->targetLabel, 'display_name' => $this->displayName, 'masked_id' => $this->maskedId, 'resolved' => $this->resolved, 'link_url' => $this->linkUrl, 'foundation_type' => $this->foundationType, 'reason_unresolved' => $this->reasonUnresolved, 'badge_text' => $this->badgeText, ]; } private static function mask(string $id): string { return substr($id, 0, 6).'…'; } }