<?php
use App\Core\Router;

$router = new Router();

// Debug route
if (APP_DEBUG) {
    $router->add('debug', 'DebugController', 'index', 'GET');
}

// Auth routes
$router->add('', 'AuthController', 'showLogin', 'GET');
$router->add('login', 'AuthController', 'showLogin', 'GET');
$router->add('login', 'AuthController', 'login', 'POST');
$router->add('logout', 'AuthController', 'logout', 'GET');

// Dashboard routes
$router->add('dashboard', 'DashboardController', 'index', 'GET');

// Migrant routes
$router->add('migrants/create', 'MigrantController', 'create', 'GET');
$router->add('migrants/search', 'MigrantController', 'search', 'GET');
$router->add('migrants', 'MigrantController', 'index', 'GET');
$router->add('migrants/store', 'MigrantController', 'store', 'POST');
$router->add('migrants/{id}', 'MigrantController', 'show', 'GET');
$router->add('migrants/{id}/edit', 'MigrantController', 'edit', 'GET');
$router->add('migrants/{id}/update', 'MigrantController', 'update', 'POST');
$router->add('migrants/{id}/submit', 'MigrantController', 'submit', 'POST');
$router->add('migrants/{id}/review', 'MigrantController', 'review', 'POST');

// User routes (these work)
$router->add('users', 'UserController', 'index', 'GET');
$router->add('profile', 'ProfileController', 'index', 'GET');

// Profile routes
$router->add('profile', 'ProfileController', 'index', 'GET');
$router->add('profile/update', 'ProfileController', 'update', 'POST');
$router->add('profile/change-password', 'AuthController', 'changePassword', 'POST');


// Admin routes
$router->add('pending', 'AdminController', 'pending', 'GET');
$router->add('users', 'UserController', 'index', 'GET');
$router->add('users/create', 'UserController', 'create', 'GET');
$router->add('users/store', 'UserController', 'store', 'POST');
$router->add('users/{id}/edit', 'UserController', 'edit', 'GET');
$router->add('users/{id}/update', 'UserController', 'update', 'POST');
$router->add('users/{id}/delete', 'UserController', 'delete', 'POST');

// Error routes
$router->add('404', 'ErrorController', 'notFound', 'GET');
$router->add('403', 'ErrorController', 'forbidden', 'GET');
$router->add('500', 'ErrorController', 'serverError', 'GET');


// Approval/Rejection routes
$router->add('approved', 'MigrantController', 'approved', 'GET');
$router->add('rejected', 'MigrantController', 'rejected', 'GET');

// Biometrics routes
$router->add('biometrics/{id}', 'BiometricsController', 'view', 'GET');
$router->add('biometrics/{id}/capture', 'BiometricsController', 'capture', 'GET');
$router->add('biometrics/{id}/store', 'BiometricsController', 'store', 'POST');

// Immigrant status routes
$router->add('status/{id}', 'ImmigrantStatusController', 'view', 'GET');
$router->add('status/{id}/add', 'ImmigrantStatusController', 'add', 'GET');
$router->add('status/{id}/store', 'ImmigrantStatusController', 'store', 'POST');
$router->add('status/{id}/edit/{status_id}', 'ImmigrantStatusController', 'edit', 'GET');
$router->add('status/{id}/update/{status_id}', 'ImmigrantStatusController', 'update', 'POST');
$router->add('status/expiring', 'ImmigrantStatusController', 'expiring', 'GET');
$router->add('status/expired', 'ImmigrantStatusController', 'expired', 'GET');

// Travel history routes
$router->add('travel/{id}', 'TravelHistoryController', 'view', 'GET');
$router->add('travel/{id}/add', 'TravelHistoryController', 'add', 'GET');
$router->add('travel/{id}/store', 'TravelHistoryController', 'store', 'POST');
$router->add('travel/{id}/edit/{travel_id}', 'TravelHistoryController', 'edit', 'GET');
$router->add('travel/{id}/update/{travel_id}', 'TravelHistoryController', 'update', 'POST');
$router->add('travel/search', 'TravelHistoryController', 'search', 'GET');

// Dependant routes
$router->add('migrants/add-dependant', 'MigrantController', 'addDependant', 'POST');
$router->add('migrants/get-dependants/{id}', 'MigrantController', 'getDependants', 'GET');
$router->add('migrants/delete-dependant', 'MigrantController', 'deleteDependant', 'POST');


