<?php

/**
 * Attendance Management module routes.
 * @var \CodeIgniter\Router\RouteCollection $routes
 */
$routes->group('attendance', ['filter' => 'auth'], static function ($routes) {
    $routes->get('/', '\Modules\Attendance\Controllers\AttendanceController::index', ['filter' => 'permission:attendance.view']);
    $routes->post('clock-in', '\Modules\Attendance\Controllers\AttendanceController::clockIn', ['filter' => 'permission:attendance.clock']);
    $routes->post('clock-out', '\Modules\Attendance\Controllers\AttendanceController::clockOut', ['filter' => 'permission:attendance.clock']);
    $routes->get('manual', '\Modules\Attendance\Controllers\AttendanceController::manualForm', ['filter' => 'permission:attendance.manual']);
    $routes->post('manual', '\Modules\Attendance\Controllers\AttendanceController::manualStore', ['filter' => 'permission:attendance.manual']);
    $routes->get('monthly', '\Modules\Attendance\Controllers\AttendanceController::monthly', ['filter' => 'permission:attendance.view']);
    $routes->get('late', '\Modules\Attendance\Controllers\AttendanceController::lateArrivals', ['filter' => 'permission:attendance.view']);
    $routes->get('early-exit', '\Modules\Attendance\Controllers\AttendanceController::earlyExits', ['filter' => 'permission:attendance.view']);
    $routes->get('overtime', '\Modules\Attendance\Controllers\AttendanceController::overtime', ['filter' => 'permission:attendance.view']);
    $routes->post('auto-punch', '\Modules\Attendance\Controllers\AttendanceController::autoPunch', ['filter' => 'permission:attendance.auto_punch']);

    $routes->get('corrections', '\Modules\Attendance\Controllers\AttendanceCorrectionController::index', ['filter' => 'permission:attendance_corrections.view']);
    $routes->get('corrections/create', '\Modules\Attendance\Controllers\AttendanceCorrectionController::createForm', ['filter' => 'permission:attendance_corrections.create']);
    $routes->post('corrections', '\Modules\Attendance\Controllers\AttendanceCorrectionController::store', ['filter' => 'permission:attendance_corrections.create']);
    $routes->post('corrections/(:num)/approve', '\Modules\Attendance\Controllers\AttendanceCorrectionController::approve/$1', ['filter' => 'permission:attendance_corrections.approve']);
    $routes->post('corrections/(:num)/reject', '\Modules\Attendance\Controllers\AttendanceCorrectionController::reject/$1', ['filter' => 'permission:attendance_corrections.approve']);

    $routes->get('shifts', '\Modules\Attendance\Controllers\AttendanceShiftController::index', ['filter' => 'permission:attendance_shifts.view']);
    $routes->get('shifts/create', '\Modules\Attendance\Controllers\AttendanceShiftController::createForm', ['filter' => 'permission:attendance_shifts.create']);
    $routes->post('shifts', '\Modules\Attendance\Controllers\AttendanceShiftController::store', ['filter' => 'permission:attendance_shifts.create']);
    $routes->get('shifts/assignments', '\Modules\Attendance\Controllers\AttendanceShiftController::assignments', ['filter' => 'permission:attendance_shifts.view']);
    $routes->post('shifts/assignments', '\Modules\Attendance\Controllers\AttendanceShiftController::assignStore', ['filter' => 'permission:attendance_shifts.edit']);
    $routes->get('shifts/(:num)/edit', '\Modules\Attendance\Controllers\AttendanceShiftController::editForm/$1', ['filter' => 'permission:attendance_shifts.edit']);
    $routes->post('shifts/(:num)', '\Modules\Attendance\Controllers\AttendanceShiftController::update/$1', ['filter' => 'permission:attendance_shifts.edit']);
    $routes->post('shifts/(:num)/activate', '\Modules\Attendance\Controllers\AttendanceShiftController::activate/$1', ['filter' => 'permission:attendance_shifts.edit']);
    $routes->post('shifts/(:num)/deactivate', '\Modules\Attendance\Controllers\AttendanceShiftController::deactivate/$1', ['filter' => 'permission:attendance_shifts.edit']);
    $routes->post('shifts/(:num)/delete', '\Modules\Attendance\Controllers\AttendanceShiftController::destroy/$1', ['filter' => 'permission:attendance_shifts.delete']);
});
