<?php

use kernel\App;
use kernel\console\controllers\MigrationController;
use Phroute\Phroute\RouteCollector;

App::$collector->console("hello", [\kernel\console\controllers\MainController::class, "indexAction"]);
App::$collector->console("help", [\kernel\console\controllers\MainController::class, "actionHelp"]);

App::$collector->group(["prefix" => "migration"], callback: function (RouteCollector $router){
    App::$collector->console('run',
        [MigrationController::class, 'actionRun'],
        additionalInfo: ['description' => 'Запуск существующих миграций']
    );
    App::$collector->console('init',
        [MigrationController::class, 'actionCreateMigrationTable'],
        additionalInfo: ['description' => 'Инициализация миграций']
    );
    App::$collector->console('create',
        [MigrationController::class, 'actionCreate'],
        additionalInfo: ['description' => 'Создание миграции', 'params' => ['--name' => 'Название миграции', '--path' => 'Путь по которому будет создана миграция']]
    );
    App::$collector->console('rollback', [MigrationController::class, 'actionRollback']);
});

App::$collector->group(["prefix" => "admin-theme"], callback: function (RouteCollector $router){
    App::$collector->console('install', [\kernel\console\controllers\AdminThemeController::class, 'actionInstallTheme']);
    App::$collector->console('uninstall', [\kernel\console\controllers\AdminThemeController::class, 'actionUninstallTheme']);
});

App::$collector->group(["prefix" => "secure"], callback: function (RouteCollector $router){
    App::$collector->console('create-secret-key', [\kernel\console\controllers\SecureController::class, 'actionCreateSecretKey']);
});

App::$collector->group(["prefix" => "admin"], callback: function (RouteCollector $router){
    App::$collector->console('init', [\kernel\console\controllers\AdminConsoleController::class, 'actionInit']);
});

App::$collector->group(["prefix" => "module"], callback: function (RouteCollector $router){
    App::$collector->console('install', [\kernel\console\controllers\ModuleController::class, 'actionInstallModule']);
    App::$collector->console('uninstall', [\kernel\console\controllers\ModuleController::class, 'actionUninstallModule']);
    App::$collector->console('pack', [\kernel\console\controllers\ModuleController::class, 'actionPackModule']);
    App::$collector->console('update', [\kernel\console\controllers\ModuleController::class, 'actionUpdateModule']);
    App::$collector->console('construct', [\kernel\console\controllers\ModuleController::class, 'actionConstructModule']);
    App::$collector->console('mk', [\kernel\console\controllers\ModuleController::class, 'actionMk']);
});

App::$collector->group(["prefix" => "kernel"], callback: function (RouteCollector $router){
//    App::$collector->console('install', [\kernel\console\controllers\ModuleController::class, 'actionInstallModule']);
//    App::$collector->console('uninstall', [\kernel\console\controllers\ModuleController::class, 'actionUninstallModule']);
    App::$collector->console('pack', [\kernel\console\controllers\KernelController::class, 'actionPackKernel']);
    App::$collector->console('update', [\kernel\console\controllers\KernelController::class, 'actionUpdateKernel']);
});

