<?php

use kernel\App;
use kernel\CgRouteCollector;

App::$collector->filter("auth", [\app\themes\svo\middlewares\LkAuthMiddleware::class, "handler"]);

App::$collector->get('/', [\app\themes\svo\controllers\LpController::class, 'actionIndex']);
App::$collector->get('/post/{postId}', [\app\themes\svo\controllers\LpController::class, 'actionPost']);

App::$collector->group(["prefix" => "admin"], function (CgRouteCollector $router) {
    App::$collector->group(["before" => "auth"], function (CGRouteCollector $router) {
        App::$collector->group(["prefix" => "svo-theme"], function (CGRouteCollector $router) {
            App::$collector->get('/settings', [\app\themes\svo\controllers\SvoAdminController::class, 'actionThemeSettings']);
            App::$collector->get('/delete_slide/{post_id}', [\app\themes\svo\controllers\SvoAdminController::class, 'actionDeleteSlide']);
            App::$collector->post('/add_slide', [\app\themes\svo\controllers\SvoAdminController::class, 'actionAddSlide']);
        });
    });
});

App::$collector->group(["prefix" => "lk"], function (CgRouteCollector $router){
    App::$collector->group(["before" => "auth"], function (CgRouteCollector $router){
        App::$collector->get('/', [\app\themes\svo\controllers\MainController::class, 'actionLk']);
        App::$collector->get('/settings', [\app\themes\svo\controllers\MainController::class, 'actionSettings']);
        App::$collector->get('/stage/{id}', [\app\themes\svo\controllers\MainController::class, 'actionStage']);
        App::$collector->post('/stage/save', [\app\themes\svo\controllers\MainController::class, 'actionStageSave']);
    });
    App::$collector->get('/login', [\app\themes\svo\controllers\MainController::class, 'actionLogin']);
    App::$collector->get('/register', [\app\themes\svo\controllers\MainController::class, 'actionRegister']);
    App::$collector->post(
        '/auth',
        [\kernel\modules\secure\controllers\SecureController::class, 'actionAuth'],
        additionalInfo: ['vars' => ['basePath' => '/lk']]
    );
    App::$collector->post(
        '/registration',
        [\kernel\modules\secure\controllers\SecureController::class, 'actionRegistration'],
        additionalInfo: ['vars' => ['basePath' => '/lk']]
    );
    App::$collector->get(
        '/logout',
        [\kernel\modules\secure\controllers\SecureController::class, 'actionLogout'],
    );
    App::$collector->post(
        '/settings/change_password',
        [\kernel\modules\secure\controllers\SecureController::class, 'actionChangePassword'],
        additionalInfo: ['vars' => ['basePath' => '/lk/settings']]
    );
});



//App::$collector->get('/page/{page_number}', [\app\modules\tag\controllers\TagController::class, 'actionIndex']);
//App::$collector->get('/create', [\app\modules\tag\controllers\TagController::class, 'actionCreate']);



