<?php

namespace KupShop\OrderDiscountBundle\Twig\Components\Discounts\Handlers;

use KupShop\ComponentsBundle\Actions\Frontend\AbstractHandler;
use KupShop\ComponentsBundle\Attributes\Entrypoint;
use KupShop\ComponentsBundle\Twig\BaseComponent;

#[Entrypoint('checkout')]
abstract class AbstractOrderDiscount extends BaseComponent
{
    public AbstractHandler $handler;

    public function getIdAction(): int
    {
        return $this->handler->getActionId();
    }

    public function getName(): string
    {
        return "action_handler[{$this->handler->getActionId()}]";
    }

    public function getTitle(): string
    {
        return $this->handler->getOrderDiscount()->getDisplayName();
    }

    public function getFrontendData(): array
    {
        return $this->handler->getData();
    }

    public function getData(): array
    {
        return $this->handler->getActionData();
    }
}
