<?php

declare(strict_types=1);

namespace KupShop\ComponentsBundle\Twig\Components\ProductList\TableView;

use KupShop\ComponentsBundle\Attributes\Component;
use KupShop\ComponentsBundle\Attributes\Version;
use KupShop\ComponentsBundle\Twig\Components\ProductList\Item;
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
use Symfony\UX\TwigComponent\Attribute\PostMount;

#[AsTwigComponent(template: '@Components/components/ProductList/TableView/TableProduct/TableProduct.1.html.twig')]
#[Component(1, [
    new Version(1, newJs: null),
])]
class TableProduct extends Item
{
    public bool $track = true;
    public bool $showModal = false;

    #[PostMount]
    #[\Override]
    public function addGTMDataAttribute(array $componentsData): array
    {
        if (!$this->track) {
            return $componentsData;
        }

        return parent::addDataAttributes($componentsData);
    }
}
