<?php

use kernel\App;
use kernel\CgRouteCollector;
use Phroute\Phroute\RouteCollector;

App::$collector->group(["prefix" => "admin"], function (CgRouteCollector $router) {
    App::$collector->group(["before" => "auth"], function (RouteCollector $router) {
        App::$collector->group(["prefix" => "tag"], function (CGRouteCollector $router) {
            App::$collector->get('/', [\app\modules\tag\controllers\TagController::class, 'actionIndex']);
            App::$collector->get('/page/{page_number}', [\app\modules\tag\controllers\TagController::class, 'actionIndex']);
            App::$collector->get('/create', [\app\modules\tag\controllers\TagController::class, 'actionCreate']);
            App::$collector->post("/", [\app\modules\tag\controllers\TagController::class, 'actionAdd']);
            App::$collector->get('/view/{id}', [\app\modules\tag\controllers\TagController::class, 'actionView']);
            App::$collector->any('/update/{id}', [\app\modules\tag\controllers\TagController::class, 'actionUpdate']);
            App::$collector->any("/edit/{id}", [\app\modules\tag\controllers\TagController::class, 'actionEdit']);
            App::$collector->get('/delete/{id}', [\app\modules\tag\controllers\TagController::class, 'actionDelete']);
        });
        App::$collector->group(["prefix" => "tag_entity"], function (CGRouteCollector $router) {
            App::$collector->get('/', [\kernel\app_modules\tag\controllers\TagEntityController::class, 'actionIndex']);
            App::$collector->get('/page/{page_number}', [\kernel\app_modules\tag\controllers\TagEntityController::class, 'actionIndex']);
            App::$collector->get('/create', [\kernel\app_modules\tag\controllers\TagEntityController::class, 'actionCreate']);
            App::$collector->post("/", [\kernel\app_modules\tag\controllers\TagEntityController::class, 'actionAdd']);
            App::$collector->get('view/{id}', [\kernel\app_modules\tag\controllers\TagEntityController::class, 'actionView']);
            App::$collector->any('/update/{id}', [\kernel\app_modules\tag\controllers\TagEntityController::class, 'actionUpdate']);
            App::$collector->any("/edit/{id}", [\kernel\app_modules\tag\controllers\TagEntityController::class, 'actionEdit']);
            App::$collector->get('/delete/{id}', [\kernel\app_modules\tag\controllers\TagEntityController::class, 'actionDelete']);
        });
        App::$collector->group(["prefix" => "settings"], function (CGRouteCollector $router) {
            App::$collector->get('/tag', [\app\modules\tag\controllers\TagController::class, 'actionSettings']);
            App::$collector->post('/tag/update', [\app\modules\tag\controllers\TagController::class, 'actionSaveSettings']);
        });
    });
});