<?php
use App\Modules\Home\Controllers\HomeController;
use App\Modules\Admin\Controllers\AdminController;
use App\Modules\Rides\Controllers\RideController;
use App\Modules\Auth\Controllers\AuthController;
use Core\Middleware\AuthMiddleware;
use Core\Middleware\AdminMiddleware;
$router->get('/login', function () {
    (new AuthController())->loginForm();
});

$router->post('/login', function () {
    (new AuthController())->login();
});

$router->get('/register', function () {
    (new AuthController())->registerForm();
});

$router->post('/register', function () {
    (new AuthController())->register();
});

$router->get('/logout', function () {
    (new AuthController())->logout();
});
$router->get('/admin', function () {

    AdminMiddleware::handle();

    (new AdminController())->dashboard();

});

$router->get('/admin/users', function () {
    (new AdminController())->users();
});

$router->get('/admin/rides', function () {
    (new AdminController())->rides();
});

$router->get('/', function () {
    (new HomeController())->index();
});

$router->get('/driver', function () {

    $id = $_GET['id'] ?? null;

    (new RideController())->showDriver($id);

});

$router->get('/home/popular-rides', function () {
    (new \App\Modules\Home\Controllers\HomeController())->popularRides();
});

$router->get('/home/testimonials', function () {
    (new \App\Modules\Home\Controllers\HomeController())->testimonials();
});
$router->get('/account', function () {
    (new \App\Modules\Account\Controllers\AccountController())->index();
});
$router->get('/logout', function () {
    (new \App\Modules\Auth\Controllers\AuthController())->logout();
});

