<?php

use App\Modules\HR\EmployeeSelfService\Controllers\MeAttendanceCorrectionController;
use App\Modules\HR\EmployeeSelfService\Controllers\MeAttendanceController;
use App\Modules\HR\EmployeeSelfService\Controllers\MeDashboardController;
use App\Modules\HR\EmployeeSelfService\Controllers\MeLeaveController;
use App\Modules\HR\EmployeeSelfService\Controllers\MeNotificationController;
use App\Modules\HR\EmployeeSelfService\Controllers\MeOvertimeController;
use App\Modules\HR\EmployeeSelfService\Controllers\MePayslipsPageController;
use App\Modules\HR\EmployeeSelfService\Controllers\MePermissionRequestController;
use App\Modules\HR\EmployeeSelfService\Controllers\MeProfileController;
use App\Modules\HR\EmployeeSelfService\Controllers\MeTeamAttendanceController;
use Illuminate\Support\Facades\Route;

Route::middleware(['module:hr'])->group(function () {
    Route::get('/dashboard', [MeDashboardController::class, 'index'])->name('dashboard');
    Route::get('/profile', [MeProfileController::class, 'show'])->name('profile');
    Route::get('/attendance', [MeAttendanceController::class, 'index'])->name('attendance.index');
    Route::post('/attendance/check-in', [MeAttendanceController::class, 'checkIn'])
        ->name('attendance.check-in');
    Route::post('/attendance/check-out', [MeAttendanceController::class, 'checkOut'])
        ->name('attendance.check-out');
    Route::get('/team/attendance', [MeTeamAttendanceController::class, 'index'])->name('team.attendance.index');
    Route::get('/attendance/corrections', [MeAttendanceCorrectionController::class, 'index'])
        ->name('attendance.corrections.index');
    Route::get('/attendance/corrections/create', [MeAttendanceCorrectionController::class, 'create'])
        ->name('attendance.corrections.create');
    Route::post('/attendance/corrections', [MeAttendanceCorrectionController::class, 'store'])
        ->name('attendance.corrections.store');
    Route::get('/leaves', [MeLeaveController::class, 'index'])->name('leaves.index');
    Route::get('/leaves/create', [MeLeaveController::class, 'create'])->name('leaves.create');
    Route::post('/leaves', [MeLeaveController::class, 'store'])->name('leaves.store');
    Route::post('/leaves/{leaveRequest}/cancel', [MeLeaveController::class, 'cancel'])
        ->whereNumber('leaveRequest')
        ->name('leaves.cancel');
    Route::get('/permission-requests', [MePermissionRequestController::class, 'index'])
        ->name('permission-requests.index');
    Route::get('/permission-requests/create', [MePermissionRequestController::class, 'create'])
        ->name('permission-requests.create');
    Route::post('/permission-requests', [MePermissionRequestController::class, 'store'])
        ->name('permission-requests.store');
    Route::get('/overtime', [MeOvertimeController::class, 'index'])->name('overtime.index');
    Route::get('/overtime/create', [MeOvertimeController::class, 'create'])->name('overtime.create');
    Route::post('/overtime', [MeOvertimeController::class, 'store'])->name('overtime.store');
    Route::get('/payslips', [MePayslipsPageController::class, 'index'])->name('payslips.index');
    Route::get('/payslips/{snapshot}', [MePayslipsPageController::class, 'show'])
        ->whereNumber('snapshot')
        ->name('payslips.show');
    Route::get('/notifications', [MeNotificationController::class, 'index'])->name('notifications.index');
    Route::post('/notifications/{id}/read', [MeNotificationController::class, 'markRead'])
        ->whereUuid('id')
        ->name('notifications.read');
    Route::post('/notifications/read-all', [MeNotificationController::class, 'markAllRead'])
        ->name('notifications.read-all');
});
