<?php

namespace KupShop\GTMBundle\PageType;

use KupShop\ContentBundle\View\ProductView;

class ProductPageType extends AbstractPageType
{
    public function getPageData(&$dataContainer)
    {
        /** @var \Product $product */
        $product = $this->view->getProduct();

        $dataContainer->products = $this->productLoader->getProducts([$product], $this->view);

        $this->addAdditionalFields($dataContainer, $product);
    }

    public function getPageType(&$dataContainer)
    {
        $dataContainer->page->type = 'product';
    }

    public static function getSupportedViews()
    {
        return [ProductView::class];
    }
}
