<?php
declare(strict_types=1);

use App\Controllers\AdminController;
use App\Controllers\ParticipantController;
use App\Core\Router;

require dirname(__DIR__) . '/app/bootstrap.php';

$router = new Router();
$participantController = new ParticipantController();
$adminController = new AdminController();

$router->get('/', [$participantController, 'home']);
$router->get('/participant/start', [$participantController, 'home']);
$router->post('/participant/start', [$participantController, 'start']);
$router->get('/participant/test', [$participantController, 'test']);
$router->post('/participant/test', [$participantController, 'answer']);
$router->get('/participant/report', [$participantController, 'report']);
$router->get('/participant/report/download', [$participantController, 'downloadReport']);

$router->get('/admin/login', [$adminController, 'loginForm']);
$router->post('/admin/login', [$adminController, 'login']);
$router->post('/admin/logout', [$adminController, 'logout']);
$router->get('/admin/register', [$adminController, 'registrationForm']);
$router->post('/admin/register', [$adminController, 'saveRegistration']);
$router->get('/admin/reports', [$adminController, 'reports']);
$router->get('/admin/reports/view', [$adminController, 'viewReport']);
$router->get('/admin/reports/download', [$adminController, 'downloadReport']);
$router->post('/admin/reports/delete', [$adminController, 'deleteReport']);
$router->get('/admin/areas', [$adminController, 'areas']);
$router->get('/admin/areas/edit', [$adminController, 'editArea']);
$router->post('/admin/areas/save', [$adminController, 'saveArea']);
$router->get('/admin/questions', [$adminController, 'questions']);
$router->get('/admin/questions/create', [$adminController, 'createQuestion']);
$router->get('/admin/questions/edit', [$adminController, 'editQuestion']);
$router->post('/admin/questions/save', [$adminController, 'saveQuestion']);
$router->post('/admin/questions/delete', [$adminController, 'deleteQuestion']);
$router->get('/admin/careers', [$adminController, 'careers']);
$router->get('/admin/careers/create', [$adminController, 'createCareer']);
$router->get('/admin/careers/edit', [$adminController, 'editCareer']);
$router->post('/admin/careers/save', [$adminController, 'saveCareer']);
$router->post('/admin/careers/delete', [$adminController, 'deleteCareer']);
$router->get('/admin/programmes', [$adminController, 'programmes']);
$router->get('/admin/programmes/create', [$adminController, 'createProgramme']);
$router->get('/admin/programmes/edit', [$adminController, 'editProgramme']);
$router->post('/admin/programmes/save', [$adminController, 'saveProgramme']);
$router->post('/admin/programmes/delete', [$adminController, 'deleteProgramme']);

$router->dispatch($_SERVER['REQUEST_METHOD'] ?? 'GET', request_path());