<?php
declare(strict_types=1);

namespace Autogedal\EanTools\Controller\Adminhtml;

use Autogedal\EanTools\Model\Spreadsheet\Format;
use Magento\Backend\App\Action\Context;
use Magento\Framework\View\Result\PageFactory;

abstract class AbstractFormatTool extends AbstractTool
{
    public function __construct(
        Context $context,
        PageFactory $resultPageFactory,
        private readonly Format $format
    ) {
        parent::__construct($context, $resultPageFactory);
    }

    protected function resolveFormat(): string
    {
        return $this->format->resolve($this->getRequest()->getParam('format'));
    }
}
