<?php

declare(strict_types=1);

namespace External\HannahBundle\SAP\EventSubscriber;

use External\HannahBundle\SAP\Util\PricingUtil;
use KupShop\OrderingBundle\Event\CartEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class CartSubscriber implements EventSubscriberInterface
{
    public function __construct(
        private PricingUtil $pricingUtil,
    ) {
    }

    public static function getSubscribedEvents(): array
    {
        return [
            CartEvent::CHECK_CART => ['onCheckCart', 200],
        ];
    }

    public function onCheckCart(): void
    {
        $this->pricingUtil->clearSAPPricingResult();
    }
}
