$items */ public function __construct( public string $label, public Collection $items ) { } public static function fromArray(array $data): self { return new self( label: $data["label"], items: (new Collection($data["items"]))->map(fn($itemData) => isset($itemData["schema"]) ? SchemaItem::fromArray($itemData) : LinkItem::fromArray($itemData)) ); } }