<?php

use App\Modules\HR\Overtime\Controllers\OvertimeRequestsPageController;
use Illuminate\Support\Facades\Route;

Route::prefix('hr/overtime')
    ->name('hr.overtime.')
    ->middleware('module:hr')
    ->group(function () {
        Route::get('/', [OvertimeRequestsPageController::class, 'index'])
            ->middleware('can:overtime.view')
            ->name('index');
        Route::get('/create', [OvertimeRequestsPageController::class, 'create'])
            ->middleware('can:overtime.create')
            ->name('create');
        Route::post('/', [OvertimeRequestsPageController::class, 'store'])
            ->middleware('can:overtime.create')
            ->name('store');
        Route::post('/{overtimeRequest}/approve', [OvertimeRequestsPageController::class, 'approve'])
            ->whereNumber('overtimeRequest')
            ->middleware('can:overtime.review')
            ->name('approve');
        Route::post('/{overtimeRequest}/reject', [OvertimeRequestsPageController::class, 'reject'])
            ->whereNumber('overtimeRequest')
            ->middleware('can:overtime.review')
            ->name('reject');
        Route::post('/{overtimeRequest}/cancel', [OvertimeRequestsPageController::class, 'cancel'])
            ->whereNumber('overtimeRequest')
            ->name('cancel');
    });
