$this->id, 'uid' => $this->uid, 'label' => $this->label, 'image' => $this->when( condition: $this->variation->type === 'image', value: fn () => [ 'id' => $this->image?->id, 'path' => $this->image?->path, ] ), 'color' => $this->when( condition: $this->variation->type === 'color', value: $this->color ), ]; } }