<?php

declare(strict_types=1);

namespace App\Router;

use Nette;
use Nette\Application\Routers\RouteList;
use Nette\Routing\Route;

final class RouterFactory
{
	use Nette\StaticClass;

	public static function createRouter(): RouteList
	{
		$router = new RouteList;

		$router->addRoute('administrace','Core:Administration:default');

		$router->addRoute('/<action>', [
			'presenter' => 'Core:Administration',
			'action' => [
				Route::FILTER_STRICT => true,
				Route::FILTER_TABLE => [
					// řetězec v URL => akce presenteru
					'prihlaseni' => 'login',
					'odhlasit' => 'logout',
					'registrace' => 'register',
					'manual' => 'manual',
				]
			]
		]);

		$router->addRoute('/<action>', [
			'presenter' => 'Core:Settings',
			'action' => [
				Route::FILTER_STRICT => true,
				Route::FILTER_TABLE => [
					// řetězec v URL => akce presenteru
					'nastaveni' => 'default',
					'uzivatele' => 'list',
					'odstranit' => 'remove',
					'opravneni' => 'opravneni',
				]
			]
		]);

		

		$router->addRoute('/<action>[/<url>]', [
			'presenter' => 'Core:Event',
			'action' => [
				Route::FILTER_STRICT => true,
				Route::FILTER_TABLE => [
					// řetězec v URL => akce presenteru
					'seznam-udalosti' => 'list',
					'editor' => 'editor',
					'odstranit' => 'remove'
				]
			]
		]);

		$router->addRoute('[<url>]', 'Core:Event:default');

		$router->addRoute('<presenter>/<action>[/<url>]', [
			'presenter' => [
				Route::FILTER_STRICT => true,
				Route::FILTER_TABLE => [
					// řetězec v URL => presenter
					'pozvanka' => 'Core:Invitation',
				],
			],
			'action' => [
				Route::FILTER_STRICT => true,
				Route::FILTER_TABLE => [
					// řetězec v URL => akce presenteru
					'seznam-pozvanek' => 'list',
					'editor' => 'editor',
					'odstranit' => 'remove'
				]
			]
		]);

		$router->addRoute('pozvanka[/<url>]', 'Core:Invitation:default');

		$router->addRoute('<presenter>/<action>[/<url>]', [
			'presenter' => [
				Route::FILTER_STRICT => true,
				Route::FILTER_TABLE => [
					// řetězec v URL => presenter
					'adresar' => 'Core:Adress',
				],
			],
			'action' => [
				Route::FILTER_STRICT => true,
				Route::FILTER_TABLE => [
					// řetězec v URL => akce presenteru
					'seznam-adresaru' => 'list',
					'editor' => 'editor',
					'odstranit' => 'remove',
					'csv' => 'import',
					'vsem' => 'sendall',
					'poslat' => 'sendone',
					'odhlasit' => 'odhlasit',
				]
			]
		]);

		$router->addRoute('adresar[/<url>]', 'Core:Adress:default');

		$router->addRoute('<presenter>/<action>[/<url>]', [
			'presenter' => [
				Route::FILTER_STRICT => true,
				Route::FILTER_TABLE => [
					// řetězec v URL => presenter
					'kontakt' => 'Core:Contact',
				],
			],
			'action' => [
				Route::FILTER_STRICT => true,
				Route::FILTER_TABLE => [
					// řetězec v URL => akce presenteru
					'editor' => 'editor',
					'editor-admin' => 'editoradmin',
					'odstranit' => 'remove',
					'novy' => 'new',
				]
			]
		]);

		$router->addRoute('kontakt[/<url>]', 'Core:Contact:default');



		return $router;
	}
}
