<?php

declare(strict_types=1);

namespace apexl\Io\modules\tabulator\Factories;

use apexl\Io\modules\tabulator\Interfaces\TabulatorAction;
use DI\Container;
use DI\DependencyException;
use DI\NotFoundException;
use function apexl\Io\assertInstanceOf;

final readonly class TabulatableActionFactory
{
    public function __construct(private Container $container) {}

    /**
     * @param class-string<TabulatorAction> $action
     * @throws DependencyException
     * @throws NotFoundException
     */
    public function make(string $action, array $params = []): TabulatorAction
    {
        assertInstanceOf($action, TabulatorAction::class);

        return $this->container->make($action, $params);
    }
}