<?php

    if(php_sapi_name() !== 'cli') {
        echo 'Error: This CLI must be run with the PHP CLI';
        exit();
    }

    use classes\Application;

    require __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'autoloader.php';

    $app = new Application();

    $app->register(new \commands\Help);
    $app->register(new \commands\Listing);
    $app->register(new \commands\Completion);
    $app->register(new \commands\Ssh);
    $app->register(new \commands\Version);

    $app->register(new \commands\show\Modules);
    $app->register(new \commands\show\Components);
    $app->register(new \commands\show\Component);
    $app->register(new \commands\show\Jobs);
    $app->register(new \commands\show\Job);

    $app->register(new \commands\make\Service);
    $app->register(new \commands\make\Controller);
    $app->register(new \commands\make\Adapter);
    $app->register(new \commands\make\Job);
    $app->register(new \commands\make\Router);
    $app->register(new \commands\make\Module);
    $app->register(new \commands\make\Form);

    $app->register(new \commands\install\Module);
    $app->register(new \commands\install\Ui);
    $app->register(new \commands\install\Cli);
    $app->register(new \commands\install\Completion);
    $app->register(new \commands\install\Dependencies);

    $app->register(new \commands\upgrade\Core);
    $app->register(new \commands\upgrade\Ui);
    $app->register(new \commands\upgrade\Cli);
    $app->register(new \commands\upgrade\Dependencies);

    $app->register(new \commands\run\Audit);
    $app->register(new \commands\run\Migrations);
    $app->register(new \commands\run\Scheduler);
    $app->register(new \commands\run\Tests);
    $app->register(new \commands\run\Repl);
    $app->register(new \commands\run\Tailwind);

    $app->register(new \commands\ansible\Setup);
    $app->register(new \commands\ansible\Ping);
    $app->register(new \commands\ansible\Provision);
    $app->register(new \commands\ansible\Domain);
    $app->register(new \commands\ansible\Deploy);
    $app->register(new \commands\ansible\Publish);
    $app->register(new \commands\ansible\Rollback);

    $app->register(new \commands\docker\Build);
    $app->register(new \commands\docker\Repl);
    $app->register(new \commands\docker\Shell);
    $app->register(new \commands\docker\Migrations);
    $app->register(new \commands\docker\Jobs);
    $app->register(new \commands\docker\Job);
    $app->register(new \commands\docker\Scheduler);
    $app->register(new \commands\docker\Sessions);
    $app->register(new \commands\docker\Tests);
    $app->register(new \commands\docker\Reset);
    $app->register(new \commands\docker\Run);
    $app->register(new \commands\docker\Fpm);

    $app->process($argv);
