<?php
namespace Incoviba\Command;

use Psr\Http\Client\ClientInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console;
use Incoviba\Common\Alias\Command;

#[Console\Attribute\AsCommand(
    name: 'run:full',
    description: 'Ejecuta todos los comandos de la aplicación'
)]
class Full extends Command
{
    public function __construct(ClientInterface $client, LoggerInterface $logger, protected array $commandsList, string $name = null)
    {
        parent::__construct($client, $logger, $name);
    }

    public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
    {
        foreach ($this->commandsList as $command) {
            $cmd = new Console\Input\ArrayInput([
                'command' => $command
            ]);
            $this->getApplication()->doRun($cmd, $output);
        }
        return Command::SUCCESS;
    }
}
