<?php

namespace KupShop\ComponentsBundle\Twig\Components\Product\VariationLabel;

use KupShop\ComponentsBundle\Attributes\Component;
use KupShop\ComponentsBundle\Attributes\Version;
use KupShop\ComponentsBundle\Twig\Components\Product\VariationLabel;
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;

#[AsTwigComponent(template: '@Components/components/Product/VariationLabel/CellSmallCatalog/CellSmallCatalog.1.html.twig')]
#[Component(1, [
    new Version(1, newJs: null),
])]
class CellSmallCatalog extends VariationLabel
{
    public int $limit = 3;

    public function getInStoreCount(): int
    {
        $count = 0;

        foreach ($this->getVariations() as $variation) {
            if (!$variation->isSoldOut()) {
                $count++;
            }
        }

        return $count;
    }
}
