<?php

declare(strict_types=1);

namespace External\PompoBundle\View;

use External\PompoBundle\Util\ProductUtil;
use Symfony\Contracts\Service\Attribute\Required;

class ProductView extends \KupShop\ContentBundle\View\ProductView
{
    #[Required]
    public ProductUtil $productUtil;

    public function getProduct()
    {
        $product = parent::getProduct();

        if ($product && $this->productCollection) {
            $product->_pompoProductCollection = $this->productCollection;
            $this->productUtil->fetchAdditionalPrices($this->productCollection);
        }

        return $product;
    }
}
