<?php

use CodeIgniter\Router\RouteCollection;

/**
 * @var RouteCollection $routes
 */



$routes->get('/', 'Home::index', ['as' => 'home']);
$routes->get('/login', 'UserController::loginForm', ['as' => 'login']);
$routes->post('/login', 'UserController::login', ['as' => 'login']);
$routes->get('/set-password/(:any)', 'UserController::setPasswordForm/$1', ['as' => 'set_password']);
$routes->post('/set-password/(:any)', 'UserController::setPassword/$1', ['as' => 'set_password']);
$routes->get('/forgot', 'UserController::forgotPasswordForm', ['as' => 'forgot']);
$routes->post('/forgot', 'UserController::sendPasswordResetLink', ['as' => 'forgot']);
$routes->get('/reset-password/(:any)', 'UserController::resetPassword/$1', ['as' => 'reset_password']);
$routes->post('/change-password/(:any)', 'UserController::changePassword/$1', ['as' => 'change_password']);
$routes->get('enter', 'VisitorController::signIn', ['as' => 'signin']);
$routes->post('enter', 'VisitorController::create', ['as' => 'signin']);
$routes->get('qr', 'VisitorController::signInByQr', ['as' => 'qr']);
$routes->get('exit', 'VisitorController::signout', ['as' => 'signout']);
$routes->post('/', 'VisitorController::create', ['as' => 'register']);
$routes->post('search', 'VisitorController::search', ['as' => 'search_last_name']);
$routes->get('visitor/signout/(:num)', 'VisitorController::visitorSignout/$1', ['as' => 'visitor_signout']);

$routes->group('admin', ['filter' => 'auth-filter'], function (RouteCollection $routes) {
    $routes->get('/', 'DashboardController::index', ['as' => 'admin_home']);
    $routes->get('logout', 'DashboardController::logout', ['as' => 'logout']);
    $routes->get('visitors', 'VisitorController::index', ['as' => 'visitors']);
    $routes->get('users', 'UserController::index', ['as' => 'users']);
    $routes->get('profile', 'UserController::profile', ['as' => 'profile']);
    $routes->get('user-profile/(:num)', 'UserController::show/$1', ['as' => 'user_profile']);
    $routes->get('edit-user/(:num)', 'UserController::edit/$1', ['as' => 'edit_profile']);
    $routes->get('block-user/(:num)', 'UserController::deactivateProfile/$1', ['as' => 'deactivate_profile']);
    $routes->get('activate-user/(:num)', 'UserController::activateProfile/$1', ['as' => 'activate_profile']);
    $routes->post('edit-user/(:num)', 'UserController::update/$1', ['as' => 'edit_profile']);
    $routes->get('delete-profile/(:num)', 'UserController::delete/$1', ['as' => 'delete_profile']);
    $routes->get('create-user', 'UserController::new', ['as' => 'create_user']);
    $routes->post('create-user', 'UserController::create', ['as' => 'create_user']);
    $routes->get('new-visitor', 'VisitorController::getNewVisitor', ['as' => 'get_new_visitor']);
    $routes->get('monitoring', 'DashboardController::monitoring', ['as' => 'monitoring']);
    $routes->get('change-my-password', 'UserController::changeMyPasswordForm', ['as' => 'change_my_password']);
    $routes->post('change-my-password', 'UserController::changeMyPassword', ['as' => 'change_my_password']);
    $routes->get('settings', 'SetupController::new', ['as' => 'settings']);
    $routes->get('edit-settings/(:num)', 'SetupController::edit/$1', ['as' => 'edit_settings']);
    $routes->post('edit-settings/(:num)', 'SetupController::update/$1', ['as' => 'edit_settings']);
});
