<?php

namespace Config;

use CodeIgniter\Router\RouteCollection;

$routes = Services::routes();
$routes->get('/', 'Auth::login');

// ----------------- AUTH ROUTES -----------------
$routes->get('login', 'Auth::login');   
$routes->post('login', 'Auth::attemptLogin'); 
$routes->get('logout', 'Auth::logout'); 

$routes->get('admin/dashboard', 'Admin::dashboard', ['filter' => 'authAdmin']);
$routes->get('employee/dashboard', 'Employee::dashboard', ['filter' => 'authEmployee']);
$routes->post('employee/punchin', 'Employee::punchIn', ['filter' => 'authEmployee']);
$routes->post('employee/punchout', 'Employee::punchOut', ['filter' => 'authEmployee']);
$routes->get('employee/attendance', 'Attendance::history', ['filter' => 'authEmployee']);

$routes->get('admin/employees', 'Employee::index', ['filter' => 'authAdmin']);
$routes->get('admin/employees/create', 'Employee::create', ['filter' => 'authAdmin']);
$routes->post('admin/employees/store', 'Employee::store', ['filter' => 'authAdmin']);
$routes->get('admin/employees/edit/(:num)', 'Employee::edit/$1', ['filter' => 'authAdmin']);
$routes->post('admin/employees/update/(:num)', 'Employee::update/$1', ['filter' => 'authAdmin']);
$routes->get('admin/employees/delete/(:num)', 'Employee::delete/$1', ['filter' => 'authAdmin']);

$routes->get('admin/attendance/export', 'Admin::export');

$routes->set404Override(); // remove custom override


// --------------------------------------------------------------------
// Auto Routing (legacy)
// --------------------------------------------------------------------
$routes->setAutoRoute(true);
