<?php

namespace ModulesGarden\Servers\ProxmoxVps\App\Cron;

use ModulesGarden\Servers\ProxmoxVps\App\Helpers\ProxmoxAddonValidator;
use ModulesGarden\Servers\ProxmoxVps\Core\ModuleConstants;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Style\SymfonyStyle;

class MainCron extends \ModulesGarden\ProxmoxAddon\Core\CommandLine\CronManager
{

    public function  run(){

        ProxmoxAddonValidator::isInstalledOrFail();
        $this->loadCommandsControllers($this->getCommands());
        $input = new ArgvInput();
        $output = new ConsoleOutput();
        $this->configureIO($input, $output);
        $io = new SymfonyStyle($input, $output);
        $io->error(sprintf("This cron is depracted since version 2.7.0, please run: %s",
            ModuleConstants::getFullPathWhmcs() . DS .'modules'. DS .'addons'. DS .'proxmoxAddon'.DS.'cron'.DS.'cron.php'));
        //queue
        $command = $this ->find('queue');
        $command->run(  $input, $output , $io );
        //update-server-usage
        $command = $this ->find('update-server-usage');
        $command->run(  $input, $output, $io  );
    }
}