<?php

use App\Http\Controllers\AIController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\API\AuthController;
use App\Http\Controllers\API\v1\PublicLeaveController;
use App\Http\Controllers\API\v1\AccumulatedLeaveCreditsController;
use App\Http\Controllers\API\v1\AdjustmentsAndDeductionsController;
use App\Http\Controllers\API\v1\AffiliationController;
use App\Http\Controllers\API\v1\AnnouncementController;
use App\Http\Controllers\API\v1\AppController;
use App\Http\Controllers\API\v1\ApplicantController;
use App\Http\Controllers\API\v1\ApproveAttendanceRequestsMobileController;
use App\Http\Controllers\API\v1\ApproverController;
use App\Http\Controllers\API\v1\AsaMeetingController;
use App\Http\Controllers\API\v1\AttendanceDenyRequestsController;
use App\Http\Controllers\API\v1\AttendanceCreationMobileController;
use App\Http\Controllers\API\v1\AttendanceRequestsMobileController;
use App\Http\Controllers\API\v1\AttendanceRequestStatusController;
use App\Http\Controllers\API\v1\EmployeeAttendanceController;
use App\Http\Controllers\API\v1\AuditController;
use App\Http\Controllers\API\v1\CompanyController;
use App\Http\Controllers\API\v1\DealershipController;
use App\Http\Controllers\API\v1\DepartmentController;
use App\Http\Controllers\API\v1\EmploymentTypeController;
use App\Http\Controllers\API\v1\UserController;
use App\Http\Controllers\API\v1\RoleController;
use App\Http\Controllers\API\v1\PermissionController;
use App\Http\Controllers\API\v1\RoleGroupController;
use App\Http\Controllers\API\v1\JobClassificationController;
use App\Http\Controllers\API\v1\JobTitleController;
use App\Http\Controllers\API\v1\NatureOfRequestController;
use App\Http\Controllers\API\v1\SalaryGradeController;
use App\Http\Controllers\API\v1\DocumentTypeController;
use App\Http\Controllers\API\v1\EmployeeController;
use App\Http\Controllers\API\v1\TypeOfMovementController;
use App\Http\Controllers\API\v1\BenefitTypeController;
use App\Http\Controllers\API\v1\CharacterReferenceController;
use App\Http\Controllers\API\v1\ChildrenController;
use App\Http\Controllers\API\v1\CompetenciesTalentsInteressController;
use App\Http\Controllers\API\v1\DeductionTypeController;
use App\Http\Controllers\API\v1\DeviceRegistrationController;
use App\Http\Controllers\API\v1\DivisionController;
use App\Http\Controllers\API\v1\DocumentTrackerController;
use App\Http\Controllers\API\v1\EducationalBackgroundController;
use App\Http\Controllers\API\v1\EmployeeLeaveController;
use App\Http\Controllers\API\v1\EmployeeLeaveCreditsController;
use App\Http\Controllers\API\v1\EmployeeObController;
use App\Http\Controllers\API\v1\EmployeeOffsetController;
use App\Http\Controllers\API\v1\EmployeeOffsetEarningController;
use App\Http\Controllers\API\v1\EmployeeOvertimeController;
use App\Http\Controllers\API\v1\EmployeeScheduleController;
use App\Http\Controllers\API\v1\EmployeeUndertimeController;
use App\Http\Controllers\API\v1\EmploymentHistoryController;
use App\Http\Controllers\API\v1\ExaminationTakenController;
use App\Http\Controllers\API\v1\FileController;
use App\Http\Controllers\API\v1\GroupController;
use App\Http\Controllers\API\v1\HolidayController;
use App\Http\Controllers\API\v1\HolidayTypeController;
use App\Http\Controllers\API\v1\LeaveApprovalController;
use App\Http\Controllers\API\v1\LeaveTypeController;
use App\Http\Controllers\API\v1\LicenseController;
use App\Http\Controllers\API\v1\LoanTypeController;
use App\Http\Controllers\API\v1\MedicalConditionController;
use App\Http\Controllers\API\v1\MedicalRecordController;
use App\Http\Controllers\API\v1\MenuController;
use App\Http\Controllers\API\v1\ModuleController;
use App\Http\Controllers\API\v1\MrfController;
use App\Http\Controllers\API\v1\NotificationController;
use App\Http\Controllers\API\v1\OffenseController;
use App\Http\Controllers\API\v1\OffsetAvailmentApprovalController;
use App\Http\Controllers\API\v1\OffsetEarningApprovalController;
use App\Http\Controllers\API\v1\OrganizationUnitController;
use App\Http\Controllers\API\v1\OvertimeApprovalController;
use App\Http\Controllers\API\v1\PagIbigTableController;
use App\Http\Controllers\API\v1\PassportController;
use App\Http\Controllers\API\v1\PayrollSettingController;
use App\Http\Controllers\API\v1\PersonalInformationController;
use App\Http\Controllers\API\v1\PersonalInterestController;
use App\Http\Controllers\API\v1\PersonnelActionFormController;
use App\Http\Controllers\API\v1\PhicTableController;
use App\Http\Controllers\API\v1\RequirementsController;
use App\Http\Controllers\API\v1\ResignationLetterController;
use App\Http\Controllers\API\v1\SalaryAndWagesController;
use App\Http\Controllers\API\v1\ScheduleShiftController;
use App\Http\Controllers\API\v1\SectionController;
use App\Http\Controllers\API\v1\SiblingController;
use App\Http\Controllers\API\v1\SssTableController;
use App\Http\Controllers\API\v1\SupportingDocumentController;
use App\Http\Controllers\API\v1\TaxTableController;
use App\Http\Controllers\API\v1\TimelogController;
use App\Http\Controllers\API\v1\TrainingHistoryController;
use App\Http\Controllers\API\v1\TravelApprovalController;
use App\Http\Controllers\API\v1\UndertimeApprovalController;
use App\Http\Controllers\API\v1\UnitController;
use App\Http\Controllers\API\v1\VisaController;
use App\Http\Controllers\API\v1\FamilyController;
use App\Http\Controllers\API\v1\LeaveLedgerController;
use App\Http\Controllers\API\v1\AutoLoginController;
use App\Http\Controllers\API\v1\ChangeScheduleApprovalController;
use App\Http\Controllers\API\v1\EmployeeChangeScheduleController;
use App\Http\Controllers\API\v1\EmployeeWfhController;
use App\Http\Controllers\API\v1\WfhApprovalController;
use App\Http\Controllers\API\v1\CutoffSettingController;
use App\Http\Controllers\API\v1\PayrollDateController;
use App\Http\Controllers\API\v1\PremiumOvertimePaySettingController;
use App\Http\Controllers\API\v1\AttendancePostingController;
use App\Http\Controllers\API\v1\AttendancePostingCronController;
use App\Http\Controllers\API\v1\BenefitCategoryController;
use App\Http\Controllers\API\v1\PayrollController;
use App\Http\Controllers\API\v1\BenefitSubCategoryController;
use App\Http\Controllers\API\v1\BiometricNotificationController;
use App\Http\Controllers\API\v1\CitizenshipController;
use App\Http\Controllers\API\v1\CivilStatusController;
use App\Http\Controllers\API\v1\ClearanceController;
use App\Http\Controllers\API\v1\ClearanceTemplateController;
use App\Http\Controllers\API\v1\DeductionFrequencyController;
use App\Http\Controllers\API\v1\EmployeeBenefitsController;
use App\Http\Controllers\API\v1\EmployeeLoanController;
use App\Http\Controllers\API\v1\EmployeeMonthlyScheduleController;
use App\Http\Controllers\API\v1\EmployeeSuspensionController;
use App\Http\Controllers\API\v1\EmployeeTimeAdjustmentController;
use App\Http\Controllers\API\v1\ImportController;
use App\Http\Controllers\API\v1\LeaveReasonController;
use App\Http\Controllers\API\v1\LocalityController;
use App\Http\Controllers\API\v1\MonthlyScheduleApprovalController;
use App\Http\Controllers\API\v1\OfficeController;
use App\Http\Controllers\API\v1\OffsetRemainingController;
use App\Http\Controllers\API\v1\PaymentContributionController;
use App\Http\Controllers\API\v1\PayrollItemsController;
use App\Http\Controllers\API\v1\PublicObController;
use App\Http\Controllers\API\v1\PublicOvertimeController;
use App\Http\Controllers\API\v1\PublicTimeAdjustmentController;
use App\Http\Controllers\API\v1\PublicUndertimeController;
use App\Http\Controllers\API\v1\RealtimeAlertController;
use App\Http\Controllers\API\v1\ReligionController;
use App\Http\Controllers\API\v1\ReportController;
use App\Http\Controllers\API\v1\ReportModuleColumnController;
use App\Http\Controllers\API\v1\ReportModuleController;
use App\Http\Controllers\API\v1\RequirementListController;
use App\Http\Controllers\API\v1\TimeAdjustmentApprovalController;
use App\Http\Controllers\API\v1\VisaTypeController;
use App\Http\Controllers\API\v1\WorkSuspensionController;
use App\Http\Controllers\API\v1\TimelogEditController;
use App\Http\Controllers\API\v1\RoleMigrationController;
// use App\Http\Controllers\API\v1\RoomController;
use App\Http\Controllers\API\v1\ViberWebHookController;
use App\Http\Controllers\API\v1\UserLogController;
use App\Http\Controllers\API\v1\SystemSettingController;
use App\Models\EmployeeOffsetEarning;
use App\Http\Controllers\API\v1\ReportCategoryController;
use App\Http\Controllers\API\v1\AnalyticsController;
use App\Http\Controllers\API\v1\ApproverApperyController;
use App\Http\Controllers\API\v1\AttendanceDeferController;
use App\Http\Controllers\API\v1\GeoController;
use App\Http\Controllers\API\v1\MrfApproverController;
use App\Http\Controllers\DocumentController;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for you r application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "api" middleware group. Make something great!
|
*/

// Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
//     return $request->user();
// });

// maintenance
// Route::get('/maintenance', function () {
//     return response()->json(['maintenance' => app()->isDownForMaintenance()]);
// });

// auto login

// Route::get('/recruitment/mrf/{token}', 'AutoLoginController@login')->name('auto.login');


Route::prefix('v1')->group(function () {
    // Real-time alert endpoints
    Route::post('/send-realtime-alert', [RealtimeAlertController::class, 'sendRealtimeAlert']);
    Route::get('/employee-online-status', [RealtimeAlertController::class, 'getEmployeeOnlineStatus']);
    Route::post('/acknowledge-alert', [RealtimeAlertController::class, 'acknowledgeAlert']);

    Route::get('/test-pusher', [RealtimeAlertController::class, 'testPusherConnection']);
    Route::get('/pusher-status', [RealtimeAlertController::class, 'getPusherStatus']);
    Route::post('/test-alert', [RealtimeAlertController::class, 'sendTestAlert']);
});

Route::controller(AuthController::class)->group(function () {
    Route::post('login', 'login');
    Route::post('register', 'register');
    Route::post('logout', 'logout');
    Route::post('refresh', 'refresh');
    Route::post('autologin/{id}', 'autoLogin');
    Route::post('email-login', [AutoLoginController::class, 'emailLogin']);
});

Route::group(['middleware' => 'custom.auth'], function() {
    Route::get('abilities', function(Request $request) {
        return $request->user()->roles()->with('permissions')
            ->get()
            ->pluck('permissions')
            ->flatten()
            ->pluck('name')
            ->unique()
            ->values()
            ->toArray();
    });
});

// Location
Route::get('v1/region', [GeoController::class, 'getRegions']);
Route::get('v1/province/{regionId}', [GeoController::class, 'getProvinces']);
Route::get('v1/city/{provinceId}', [GeoController::class, 'getCities']);
Route::get('v1/barangay/{cityId}', [GeoController::class, 'getBarangays']);

Route::get('get-apps-storage', [AppController::class, 'getAppsStorage']);

// Accumulated Leave
Route::resource('/v1/accumulated-leave', AccumulatedLeaveCreditsController::class);

// Expiration of Offset
Route::get('/v1/offset-expiration', [OffsetRemainingController::class, 'offsetExpiration']);

// Route::get('/user', [UserController::class, 'index']);

Route::get('/user', function (Request $request) {
    return response()->json($request->user());
});

Route::group(['prefix' => 'v1'], function () {
    // Route::post('applicant', [ApplicantController::class, 'store'])->name('applicant.store');
    Route::apiResources(['applicant' => ApplicantController::class]);
    Route::apiResources([
        'mrf' => MrfController::class,
    ], [
        'only' => ['index', 'show']
    ]);
    Route::get('mrf-approved', [MrfController::class, 'showApprovedMrf']);
    Route::get('mrf-open-positions', [MrfController::class, 'showOpenPositionMrf']);
    // Route::post('mrf/update', [MrfController::class, 'update']);
});

// Sync Bio
Route::group(['prefix'=> 'v1'], function(){
    Route::get('/sync-bio', [TimelogController::class, 'sync_bio']);
    Route::get('/timelogs', [TimelogController::class, 'show']);
    Route::get('/timelogFromOtherDealer', [TimelogController::class, 'timelogFromOtherDealer']);
    // Route::get('/recruitment/mrf/{token}', [AutoLoginController::class, 'login'])->name('auto.login');
});

Route::group(['prefix'=> 'v1/file'], function(){
    Route::get('/read', [FileController::class, 'readFile']);
    Route::get('/download/{file}', [FileController::class, 'downloadFile']);
});

Route::group(['prefix' => 'v1', 'middleware' => 'custom.auth'], function () {

    // Get Employee Timelogs
    Route::get('/employee-timelogs/{id}', [TimelogController::class, 'getEmployeeTimelogs']);

    Route::group(['prefix' => 'settings'], function () {

        // Route::get('/menu/parent', [MenuController::class, 'getParent']);
        Route::get('/all-menus', [MenuController::class, 'all']);
        Route::get('/user-menus/{user_id}', [MenuController::class, 'userMenu']);

        Route::get('/role-dealership-access/{id}', [RoleController::class, 'RoleDealershipAccess']);
        Route::get('/all-role-dealership-access', [RoleController::class, 'AllRoleDealershipAccess']);
        Route::post('/role-permissions', [PermissionController::class, 'SaveRolePermissions']);
        Route::get('/role-permissions', [PermissionController::class, 'getAllRolePermissions']);
        Route::get('/role-permissions/{id}', [PermissionController::class, 'getRolePermissions']);
        Route::put('/save-role-permissions', [PermissionController::class, 'SaveRolePermissions']);
        Route::get('/company-permissions', [PermissionController::class, 'CompanyPermissions']);


        Route::get('/user-role/{id}', [UserController::class, 'UserRole']);

        Route::post('/menus/user', [MenuController::class, 'saveMenuUser']);
        Route::get('/menu-list', [MenuController::class, 'list']);
        Route::get('/filtered-users', [UserController::class, 'filtered']);
        Route::post('system-settings/update-setting', [SystemSettingController::class, 'updateSetting']);
        Route::get('/users/options', [UserController::class, 'options']);


        Route::apiResources([
            'users' => UserController::class,
            'role-groups' => RoleGroupController::class,
            'roles' => RoleController::class,
            'permissions' => PermissionController::class,
            'modules' => ModuleController::class,
            'menus' => MenuController::class,
            'user-logs' => UserLogController::class,
            'system-settings' => SystemSettingController::class,
        ]);


    });

    Route::apiResources([
        'leave-ledger' => LeaveLedgerController::class,
        'employee-leave' => EmployeeLeaveController::class,
        'employee-overtime' => EmployeeOvertimeController::class,
        'employee-time-adjustment' => EmployeeTimeAdjustmentController::class,
        'employee-change-schedule' => EmployeeChangeScheduleController::class,
        'employee-undertime' => EmployeeUndertimeController::class,
        'employee-ob' => EmployeeObController::class,
        'employee-offset' => EmployeeOffsetController::class,
        'employee-offset-earning' => EmployeeOffsetEarningController::class,
        'employee-wfh' => EmployeeWfhController::class,
        'employee-loans' => EmployeeLoanController::class,
        'medical-condition' => MedicalConditionController::class,
        'requirement' => RequirementsController::class,
        'offense' => OffenseController::class,
        'office' => OfficeController::class,
        'clearance' => ClearanceController::class,
    ], [
        'except' => ['update']
    ]);

    Route::apiResources([
        'mrf' => MrfController::class,
    ], [
        'except' => ['index', 'show', 'update']
    ]);

    Route::apiResources([
        'paf' => PersonnelActionFormController::class,
    ], [
        'except' => ['update']
    ]);

    Route::get('leave-credits', [EmployeeLeaveController::class, 'getLeaveCredits']);
    Route::get('holidays-and-days-off', [EmployeeLeaveController::class, 'getHolidaysAndDaysOff']);
    Route::get('get-working-hours', [EmployeeScheduleController::class, 'getEmployeeWorkingHoursForChangeSchedule']);
    Route::get('get-holiday', [EmployeeAttendanceController::class, 'getHoliday']);
    Route::get('isWFH', [EmployeeAttendanceController::class, 'isWFH']);
    Route::get('isPasswordExpired', [UserController::class, 'isPasswordExpired']);

    Route::get('get-employee-loans', [EmployeeLoanController::class, 'getRecordByEmployee']);
    Route::get('get-employee-payment-contribution', [PaymentContributionController::class, 'getRecordByEmployee']);
    Route::get('get-employee-deductions', [EmployeeController::class, 'getRecordByEmployee']);
    Route::get('/company-payroll-setting',[PayrollSettingController::class, 'companySetting']);
    // Timekeeping List
    // Approve Requests for Mobile
    Route::prefix('timekeeping-list')->group(function () {
        Route::get('leave', [EmployeeLeaveController::class, 'getLeaveList']);
        Route::get('leave-mandatory', [EmployeeLeaveController::class, 'getLeaveMandatoryList']);
        Route::get('overtime', [EmployeeOvertimeController::class, 'getOvertimeList']);
        Route::get('time-adjustment', [EmployeeTimeAdjustmentController::class, 'getTimeAdjustmentList']);
        Route::get('change-schedule', [EmployeeChangeScheduleController::class, 'getChangeScheduleList']);
        Route::get('ob', [EmployeeObController::class, 'getObList']);
        Route::get('undertime', [EmployeeUndertimeController::class, 'getUndertimeList']);
        Route::get('offset-earning', [EmployeeOffsetEarningController::class, 'getOffsetEarningList']);
        Route::get('offset-availment', [EmployeeOffsetController::class, 'getOffsetAvailmentList']);
        Route::get('wfh', [EmployeeWfhController::class, 'getWfhList']);
        Route::get('monthly-schedule',[EmployeeMonthlyScheduleController::class,'getMonthlySchedList']);
    });

    Route::post('medical-condition/update', [MedicalConditionController::class, 'update']);
    Route::post('requirement/update', [RequirementsController::class, 'update']);
    Route::post('offense/update', [OffenseController::class, 'update']);

    Route::post('defer-attendance', [AttendanceDeferController::class, 'store']);
    
    Route::post('employee-leave/create/mandatory', [EmployeeLeaveController::class, 'createMandatory']);
    
    Route::post('employee-leave/update', [EmployeeLeaveController::class, 'update']);
    Route::post('employee-overtime/update', [EmployeeOvertimeController::class, 'update']);
    Route::post('employee-time-adjustment/update', [EmployeeTimeAdjustmentController::class, 'update']);
    Route::post('employee-change-schedule/update', [EmployeeChangeScheduleController::class, 'update']);
    Route::post('employee-undertime/update', [EmployeeUndertimeController::class, 'update']);
    Route::post('employee-ob/update', [EmployeeObController::class, 'update']);
    Route::post('employee-offset/update', [EmployeeOffsetController::class, 'update']);
    Route::post('employee-offset-earning/update', [EmployeeOffsetEarningController::class, 'update']);
    Route::post('employee-wfh/update', [EmployeeWfhController::class, 'update']);
    Route::post('employee-loans/update', [EmployeeLoanController::class, 'update']);
    Route::post('clearance/update', [ClearanceController::class, 'update']);
    Route::post('clearance/process-clearance', [ClearanceController::class, 'processClearance']);

    Route::put('clearance-signatories-update/{id}', [ClearanceController::class, 'updateSignatories']);
    Route::put('clearance-signatories-approve/{id}', [ClearanceController::class, 'approveSignatories']);
    Route::put('clearance-signatories-unapprove/{id}', [ClearanceController::class, 'unapproveSignatories']);
    Route::post('clearance-save-comment/{id}/comment', [ClearanceController::class, 'saveComment']);
    Route::get('clearance-get-comment/{id}/comment', [ClearanceController::class, 'getComment']);
    Route::get('clearance-completed', [ClearanceController::class, 'getCompleted']);
    Route::get('clearance-for-approval', [ClearanceController::class, 'getClearanceForApproval']);
    Route::get('clearance-count', [ClearanceController::class, 'getApprovalProcessCounts']);

    // Get attendance data (with caching)
    Route::post('/attendancesync', [EmployeeAttendanceController::class, 'index']);

    // Force resync calendar data
    Route::post('/attendance/resync', [EmployeeAttendanceController::class, 'resyncCalendar']);

    // Get daily attendance for sidebar
    Route::post('/attendance/daily', [EmployeeAttendanceController::class, 'getDailyAttendance']);

    // Get clearances for approval
    // Route::get('/clearances/for-approval', [ClearanceController::class, 'getForApproval']);
    // Get specific clearance
    // Route::get('/clearances/{id}', [ClearanceController::class, 'show']);
    // Return clearance to status
    Route::put('/clearances/{id}/return-to-status', [ClearanceController::class, 'returnToStatus']);
    // Get status logs for a clearance
    // Route::get('/clearances/{id}/status-logs', [ClearanceController::class, 'getStatusLogs']);

    Route::prefix('clearance')->group(function () {
        Route::post('{id}/submit-computation', [ClearanceController::class, 'submitComputation']);
        Route::post('{id}/process-clearance', [ClearanceController::class, 'processClearance']);
        Route::get('{id}/attachments', [ClearanceController::class, 'getClearanceAttachments']);
        Route::delete('{id}/attachment', [ClearanceController::class, 'deleteAttachment']);
    });

    Route::put('employee-loans-activation/{id}', [EmployeeLoanController::class, 'activation']);
    Route::put('employee-contribution-activation/{id}', [PaymentContributionController::class, 'activation']);
    Route::put('loan-full-payment/{id}', [EmployeeLoanController::class, 'fullPayment']);


    Route::post('mrf/update', [MrfController::class, 'update']);
    Route::post('paf/update', [PersonnelActionFormController::class, 'update']);

    Route::put('applicant/update-status/{applicant}', [ApplicantController::class, 'updateStatus']);
    Route::put('applicant/blocklist/{applicant}', [ApplicantController::class, 'blocklist']);
    Route::get('mrf-applicant', [MrfController::class, 'showMrfWithApplicants']);
    Route::get('mrf-archive-applicant', [MrfController::class, 'showArchiveApplicants']);
    Route::get('mrf-blocklist-applicant', [MrfController::class, 'showBlocklistApplicants']);
    Route::get('employee-loans/full-payment/{id}', [EmployeeLoanController::class, 'fullPaymentList']);

    Route::get('employee-list', [EmployeeController::class, 'employeeList']);

    Route::apiResources([
        'apps' => AppController::class,
        'employees' => EmployeeController::class,
        'companies' => CompanyController::class,
        'job-classifications' => JobClassificationController::class,
        'job-titles' => JobTitleController::class,
        'employment-type' => EmploymentTypeController::class,
        'salary-grade' => SalaryGradeController::class,
        'dealerships' => DealershipController::class,
        'departments' => DepartmentController::class,
        'nature-of-request' => NatureOfRequestController::class,
        'document-type' => DocumentTypeController::class,
        'visa-type' => VisaTypeController::class,
        'citizenship' => CitizenshipController::class,
        'civil-status' => CivilStatusController::class,
        'religion' => ReligionController::class,
        'type-of-movement' => TypeOfMovementController::class,
        'supporting-documents' => SupportingDocumentController::class,
        'holiday-type' => HolidayTypeController::class,
        'holiday' => HolidayController::class,
        'educational-background' => EducationalBackgroundController::class,
        'employment-history' => EmploymentHistoryController::class,
        'training-history' => TrainingHistoryController::class,
        'schedule-shift' => ScheduleShiftController::class,
        'leave-type' => LeaveTypeController::class,
        'leave-reason' => LeaveReasonController::class,
        'employee-leave-credits' => EmployeeLeaveCreditsController::class,
        'examination-taken' => ExaminationTakenController::class,
        'competencies-talents-interests' => CompetenciesTalentsInteressController::class,
        'character-reference' => CharacterReferenceController::class,
        'role-groups' => RoleGroupController::class,
        'tax-table' => TaxTableController::class,
        'sss-table' => SssTableController::class,
        'phic-table' => PhicTableController::class,
        'pag-ibig-table' => PagIbigTableController::class,
        'loan-type' => LoanTypeController::class,
        'medical-record' => MedicalRecordController::class,
        'payroll-setting' => PayrollSettingController::class,
        'deduction-type' => DeductionTypeController::class,
        'device-registration' => DeviceRegistrationController::class,
        'passport' => PassportController::class,
        'visa' => VisaController::class,
        'license' => LicenseController::class,
        'affiliation' => AffiliationController::class,
        'group' => GroupController::class,
        'division' => DivisionController::class,
        'section' => SectionController::class,
        'resignation-letter' => ResignationLetterController::class,
        'document-tracker' => DocumentTrackerController::class,
        'personal-interest' => PersonalInterestController::class,
        'sibling' => SiblingController::class,
        'children' => ChildrenController::class,
        'unit' => UnitController::class,
        'approver' => ApproverController::class,
        'organization-unit' => OrganizationUnitController::class,
        'employee-schedule' => EmployeeScheduleController::class,
        'mrf-approvers' => MrfApproverController::class,
        'employee-monthly-schedule' => EmployeeMonthlyScheduleController::class,
        'work-suspension' => WorkSuspensionController::class,

        // Reports
        'report' => ReportController::class,
        'report-module' => ReportModuleController::class,
        'report-module-columns' => ReportModuleColumnController::class,
        'report-categories' => ReportCategoryController::class,

        // Approvals
        'leave-approval' => LeaveApprovalController::class,
        'monthly-schedule-approval' => MonthlyScheduleApprovalController::class,
        'overtime-approval' => OvertimeApprovalController::class,
        'time-adjustment-approval' => TimeAdjustmentApprovalController::class,
        'change-schedule-approval' => ChangeScheduleApprovalController::class,
        'undertime-approval' => UndertimeApprovalController::class,
        'travel-approval' => TravelApprovalController::class,
        'wfh-approval' => WfhApprovalController::class,
        'offset-approval' => OffsetAvailmentApprovalController::class,
        'offset-earning-approval' => OffsetEarningApprovalController::class,
        'attendance' => EmployeeAttendanceController::class,
        'notification' => NotificationController::class,
        'announcement' => AnnouncementController::class,
        'asa-meeting' => AsaMeetingController::class,
        'employee-suspension' => EmployeeSuspensionController::class,

        //Payroll settings
        'cut-off-settings' => CutoffSettingController::class,
        'payroll-dates' => PayrollDateController::class,

        // Benefits
        'benefits-category' => BenefitCategoryController::class,
        'benefits-sub-category' => BenefitSubCategoryController::class,
        'benefits-type' => BenefitTypeController::class,

        // Payroll Items
        'payroll-items' => PayrollItemsController::class,

        // Adjustment and Deductions
        'adjustments-and-deductions' => AdjustmentsAndDeductionsController::class,

        // Employee Benefits
        'employee-benefits' => EmployeeBenefitsController::class,

        // Deduction Frequency
        'deduction-frequency' => DeductionFrequencyController::class,

        // Clearance
        'clearance-template' => ClearanceTemplateController::class,

        'premium-overtime-pay-settings' => PremiumOvertimePaySettingController::class,
        'attendance-postings' => AttendancePostingController::class,
        'payroll' => PayrollController::class,

        //
        'locality' => LocalityController::class,
        'requirement-list' => RequirementListController::class,

        // Payment Contributions
        'payment-contribution' => PaymentContributionController::class,

    ]);

    //Signatories
    Route::put('clearance-template-signatories/{id}', [ClearanceTemplateController::class, 'updateSignatory']);
    Route::get('clearance-template-signatories/{id}', [ClearanceTemplateController::class, 'getSignatories']);

    Route::get('getMobileTimelogs', [EmployeeAttendanceController::class, 'getMobileTimelogs']);

    // Get Processed Attendance
    Route::get('processed-attendance',[EmployeeAttendanceController::class, 'getProcessedAttendance']);

    Route::get('/my-payslips',[PayrollController::class, 'myPayslips']);
    Route::get('/employee-payslips',[PayrollController::class, 'employeePayslips']);
    Route::get('/payslip-details',[PayrollController::class, 'employeePayslipDetails']);
    Route::get('/payroll-date/get-cut-off',[PayrollDateController::class, 'getCutOff']);
    Route::get('/payroll-date/get-posted-attendance',[PayrollDateController::class, 'getPostedAttendance']);
    Route::get('/payroll-date/get-dealership-posted',[PayrollDateController::class, 'getDealerWithAttendancePosting']);
    Route::get('/payroll-date/get-company-posted',[PayrollDateController::class, 'getcompanyWithAttendancePosting']);
    Route::get('/payroll-date/get-employee-posted',[PayrollDateController::class, 'getEmployeeWithAttendancePosting']);

    //

    Route::get('/payroll-date/get-date-payroll-summary',[PayrollDateController::class, 'getPayrollSummaries']);
    Route::get('/payroll-date/get-payroll-summary',[PayrollDateController::class, 'getDealerWithPayrollSummary']);
    Route::get('/payroll-date/get-employee-payroll',[PayrollDateController::class, 'getEmployeeWithPayrollSummary']);
    Route::get('/get-payroll-summary',[PayrollController::class, 'getPayrollSummaries']);

    Route::get('/employee-process-attendance',[EmployeeAttendanceController::class, 'processAttendance']);
    Route::prefix('payroll')->group(function () {
        Route::post('compute',[PayrollController::class, 'computePayroll']);
        Route::post('payroll-dates',[PayrollController::class, 'payrollDates']);
        Route::post('adjustments',[PayrollController::class, 'adjustmentsAndDeductions']);
        Route::post('save-file',[PayrollController::class, 'saveFile']);
        Route::post('save-file-pdf',[PayrollController::class, 'saveFilePdf']);
        Route::post('post/{id}',[PayrollController::class, 'post']);
        Route::post('release/{id}',[PayrollController::class, 'release']);
    });
    Route::get('/view-payroll-summary',[PayrollController::class, 'viewFile']);
    Route::prefix('attendance-postings')->group(function () {
    Route::post('post',[AttendancePostingController::class, 'postRecord']);
    Route::post('unpost',[AttendancePostingController::class, 'unpostRecord']);

});
Route::prefix('analytics')->group(function () {
    Route::get('current-stats',[AnalyticsController::class, 'currentMonthStats']);
    Route::get('hiring-trend',[AnalyticsController::class, 'hiringTrend']);
    Route::get('attendance-summary',[AnalyticsController::class,'attendanceSummary']);
Route::get('head-count-summary',[AnalyticsController::class, 'headCountSummary']);
});

Route::put('adjustments-activation/{id}', [AdjustmentsAndDeductionsController::class, 'activation']);

    // Removing of attachments
    Route::prefix('remove-attachment')->group(function () {
        Route::put('leave', [EmployeeLeaveController::class, 'removeAttachment']);
        Route::put('overtime', [EmployeeOvertimeController::class, 'removeAttachment']);
        Route::put('travel', [EmployeeObController::class, 'removeAttachment']);
        Route::put('undertime', [EmployeeUndertimeController::class, 'removeAttachment']);
        Route::put('offset-availment', [EmployeeOffsetController::class, 'removeAttachment']);
        Route::put('offset-earning', [EmployeeOffsetEarningController::class, 'removeAttachment']);
        Route::put('wfh', [EmployeeWfhController::class, 'removeAttachment']);

        Route::put('mrf', [MrfController::class, 'removeAttachment']);

    });

    /**Create batch payroll dates */
    Route::post('payroll-dates/batch-create', [PayrollDateController::class, 'storeBatch']);

    Route::get('employee-schedule-profile', [EmployeeController::class, 'getCurrentScheduleProfile']);
    Route::get('employee-current-schedule', [EmployeeController::class, 'getCurrentSchedule']);
    Route::get('password-checker', [EmployeeController::class, 'passwordChecker']);
    Route::put('password-update', [EmployeeController::class, 'updatePassword']);

    // Get Leave Hours Depends on Employee Schedule working hours
    Route::get('leave-hours-depends-on-working-schedule', [AttendanceCreationMobileController::class, 'getHoursForLeaveDependsOnSchedule']);

    // Check WFH
    Route::post('check-wfh', [EmployeeWfhController::class, 'checkIfWfh']);

    // Leave Type for Mobile
    Route::get('get-leave-type', [LeaveTypeController::class, 'getLeaveType']);

    // Get only the leave type that exists on employee leave credits
    Route::get('employee-leave-type', [LeaveTypeController::class, 'getEmployeeLeaveType']);

    // Approve Requests for Mobile
    Route::prefix('approve-requests')->group(function () {
        Route::post('leave', [ApproveAttendanceRequestsMobileController::class, 'approve_leave_request']);
        Route::post('overtime', [ApproveAttendanceRequestsMobileController::class, 'approve_overtime_request']);
        Route::post('undertime', [ApproveAttendanceRequestsMobileController::class, 'approve_undertime_request']);
        Route::post('travel', [ApproveAttendanceRequestsMobileController::class, 'approve_travel_request']);
        Route::post('offset-availment', [ApproveAttendanceRequestsMobileController::class, 'approve_offset_availment_request']);
        Route::post('offset-earning', [ApproveAttendanceRequestsMobileController::class, 'approve_offset_earning_request']);
        Route::post('time-adjustment', [ApproveAttendanceRequestsMobileController::class, 'approve_time_adjustment_request']);
    });

    // Attendance Requests for Mobile
    Route::prefix('view-requests')->group(function () {
        Route::get('leave', [AttendanceRequestsMobileController::class, 'leave_request']);
        Route::get('overtime', [AttendanceRequestsMobileController::class, 'overtime_request']);
        Route::get('undertime', [AttendanceRequestsMobileController::class, 'undertime_request']);
        Route::get('travel', [AttendanceRequestsMobileController::class, 'travel_request']);
        Route::get('offset-availment', [AttendanceRequestsMobileController::class, 'offset_availment_request']);
        Route::get('offset-earning', [AttendanceRequestsMobileController::class, 'offset_earning_request']);
        Route::get('time-adjustment', [AttendanceRequestsMobileController::class, 'time_adjustment']);
        Route::get('earned-offset', [AttendanceRequestsMobileController::class, 'offset_lists']);
        Route::get('availed-offset', [AttendanceRequestsMobileController::class, 'offset_availment_lists']);
    });

    // Create Requests
    Route::prefix('store-requests')->group(function () {
        Route::post('leave', [AttendanceCreationMobileController::class, 'leave_request']);
        Route::post('overtime', [AttendanceCreationMobileController::class, 'overtime_request']);
        Route::post('undertime', [AttendanceCreationMobileController::class, 'undertime_request']);
        Route::post('travel', [AttendanceCreationMobileController::class, 'travel_request']);
        Route::post('offset-availment', [AttendanceCreationMobileController::class, 'offset_availment_request']);
        Route::post('offset-earning', [AttendanceCreationMobileController::class, 'offset_earning_request']);
        Route::post('time-adjustment', [AttendanceCreationMobileController::class, 'time_adjustment_request']);
    });

    // Deny
    Route::prefix('deny-requests')->group(function () {
        Route::post('leave', [AttendanceDenyRequestsController::class, 'leave_request']);
        Route::post('overtime', [AttendanceDenyRequestsController::class, 'overtime_request']);
        Route::post('undertime', [AttendanceDenyRequestsController::class, 'undertime_request']);
        Route::post('travel', [AttendanceDenyRequestsController::class, 'travel_request']);
        Route::post('offset-availment', [AttendanceDenyRequestsController::class, 'offset_availment_request']);
        Route::post('offset-earning', [AttendanceDenyRequestsController::class, 'offset_earning_request']);
    });

    // API APPROVER
    Route::get('employee-approver-api/{employee_id}', [ApproverApperyController::class, 'getEmployeeApprover']);

    // Meeting
    Route::get('room-availability', [AsaMeetingController::class, 'getRoomAvailability']);
    Route::get('meeting-invitation', [AsaMeetingController::class, 'getMeetingInvitation']);
    Route::put('meeting-confirmation/{id}', [AsaMeetingController::class, 'updateMeetingConfirmation']);

    //
    Route::get('check-duplicated-email', [EmployeeController::class, 'countDuplicatedEmail']);
    Route::get('check-duplicated-employee-id', [EmployeeController::class, 'countDuplicatedEmployeeId']);

    // Attendance Requests for Mobile
    Route::prefix('view-requests')->group(function () {
        Route::get('leave', [AttendanceRequestsMobileController::class, 'leave_request']);
        Route::get('overtime', [AttendanceRequestsMobileController::class, 'overtime_request']);
        Route::get('undertime', [AttendanceRequestsMobileController::class, 'undertime_request']);
        Route::get('travel', [AttendanceRequestsMobileController::class, 'travel_request']);
        Route::get('offset-availment', [AttendanceRequestsMobileController::class, 'offset_availment_request']);
        Route::get('offset-earning', [AttendanceRequestsMobileController::class, 'offset_earning_request']);
    });

    Route::prefix('requests')->group(function () {
        Route::post('leave', [AttendanceCreationMobileController::class, 'leave_request']);
        // Route::get('overtime', [AttendanceRequestsMobileController::class, 'overtime_request']);
        // Route::get('undertime', [AttendanceRequestsMobileController::class, 'undertime_request']);
        // Route::get('travel', [AttendanceRequestsMobileController::class, 'travel_request']);
        // Route::get('offset-availment', [AttendanceRequestsMobileController::class, 'offset_availment_request']);
        // Route::get('offset-earning', [AttendanceRequestsMobileController::class, 'offset_earning_request']);
    });

    // Announcement
    Route::get('room-availability', [AsaMeetingController::class, 'getRoomAvailability']);
    Route::get('meeting-invitation', [AsaMeetingController::class, 'getMeetingInvitation']);
    Route::put('meeting-confirmation/{id}', [AsaMeetingController::class, 'updateMeetingConfirmation']);

    // All Employee
    Route::get('all-employees', [EmployeeController::class, 'getAllEmployees']);
    Route::get('all-employees-without-resign', [EmployeeController::class, 'getAllEmployeesWithoutResign']);
    Route::get('all-employees-payroll', [EmployeeController::class, 'getAllEmployeesForPayrollAccess']);

    // Get Employee Based on Department
    Route::get('employee-based-on-department', [EmployeeController::class, 'getEmployeesBasedOnDepartment']);

    // Announcement Record
    Route::get('announcement-record', [AnnouncementController::class, 'show']);

    // Attendance Request Status
    Route::get('attendance-request-status', [AttendanceRequestStatusController::class, 'index']);
    Route::get('validation-request-status', [AttendanceRequestStatusController::class, 'validationRequests']);

    // Image Upload for Profile Picture
    Route::post('employee-image-upload', [EmployeeController::class, 'imageUpload']);

    // For Bell Notification
    Route::get('bell-notification/{id}', [NotificationController::class, 'getNotificationForBell']);

    // Update approvers
    Route::put('update-leave-approval/{id}', [LeaveApprovalController::class, 'updateApprover']);
    Route::put('validate-leave-approval/{id}', [LeaveApprovalController::class, 'HrValidation']);
    Route::put('update-overtime-approval/{id}', [OvertimeApprovalController::class, 'updateApprover']);
    Route::put('validate-overtime-approval/{id}', [OvertimeApprovalController::class, 'HrValidation']);
    Route::put('update-time-adjustment-approval/{id}', [TimeAdjustmentApprovalController::class, 'updateApprover']);
    Route::put('validate-time-adjustment-approval/{id}', [TimeAdjustmentApprovalController::class, 'HrValidation']);
    Route::put('update-change-schedule-approval/{id}', [ChangeScheduleApprovalController::class, 'updateApprover']);
    Route::put('validate-change-schedule-approval/{id}', [ChangeScheduleApprovalController::class, 'HrValidation']);
    Route::put('update-undertime-approval/{id}', [UndertimeApprovalController::class, 'updateApprover']);
    Route::put('validate-undertime-approval/{id}', [UndertimeApprovalController::class, 'HrValidation']);
    Route::put('update-travel-approval/{id}', [TravelApprovalController::class, 'updateApprover']);
    Route::put('validate-travel-approval/{id}', [TravelApprovalController::class, 'HrValidation']);
    Route::put('update-wfh-approval/{id}', [WfhApprovalController::class, 'updateApprover']);
    Route::put('validate-wfh-approval/{id}', [WfhApprovalController::class, 'HrValidation']);
    Route::put('update-offset-approval/{id}', [OffsetAvailmentApprovalController::class, 'updateApprover']);
    Route::put('update-offset-earning-approval/{id}', [OffsetEarningApprovalController::class, 'updateApprover']);
    Route::put('update-monthly-schedule-approval/{id}', [MonthlyScheduleApprovalController::class, 'updateApprover']);
    Route::put('validate-monthly-schedule-approval/{id}', [MonthlyScheduleApprovalController::class, 'HrValidation']);

    // Salary and Wages Store
    Route::apiResources([
        'salary-and-wages' => SalaryAndWagesController::class,
        'personal-information' => PersonalInformationController::class,
        'family' => FamilyController::class,
    ], [
        'except' => ['store']
    ]);

    Route::post('salary-and-wages/{id}', [SalaryAndWagesController::class, 'store']);
    Route::post('personal-information/{id}', [PersonalInformationController::class, 'store']);
    Route::post('family/{id}', [FamilyController::class, 'store']);

    // Update Status
    Route::put('mrf/{id}/update-mrf-status', [MrfController::class, 'updateStatus']);
    Route::put('mrf/{id}/close-mrf', [MrfController::class, 'closeMrf']);
    Route::put('paf/{id}/update-paf-status', [PersonnelActionFormController::class, 'updateStatus']);

    // Audit
    Route::get('attendance-request', [AttendanceRequestStatusController::class, 'index']);

    //
    Route::post('add-tito', [EmployeeAttendanceController::class, 'addTITO']);
    Route::get('employee-daily-attendance', [EmployeeAttendanceController::class, 'getDailyAttedance']);

    // Audit
    Route::get('transaction-audit', [AuditController::class, 'index']);

    // Approver
    Route::get('mrf-approver', [ApproverController::class, 'getMrfApprover']);
    Route::get('employee-approver/{employee_id}', [ApproverController::class, 'getEmployeeApprover']);
    Route::get('employee-under-approver', [ApproverController::class, 'getEmployeeUnderApprover']);

    // Get HR Manager of the company for MRF
    Route::get('get-hr-manager/{company_id}', [EmployeeController::class, 'getHrManager']);
    Route::post('save-apps-storage', [AppController::class, 'saveAppsStorage']);
    Route::get('get-apps-storage', [AppController::class, 'getAppsStorage']);

    // Get Hierarchy
    Route::get('get-absent-tardiness-head-dashboard', [EmployeeAttendanceController::class, 'getAbsentTardinessHeadDashboard']);

    // Get Hierarchy
    Route::get('on-boarding/{employee_id}', [ApplicantController::class, 'newEmployee']);

    Route::get('generate-attendance-posting', [AttendancePostingCronController::class, 'index']);

    // Report Generation
    Route::get('report-generation', [ReportController::class, 'generateReport']);
    Route::post('save-report-generated', [ReportController::class, 'saveGeneratedReport']);
    Route::post('send-report-generated', [ReportController::class, 'sendGeneratedReport']);
    Route::post('share-report-generated', [ReportController::class, 'shareGeneratedReport']);
    Route::get('get-save-report', [ReportController::class, 'getSaveGenerated']);
    Route::get('report-generation-attendance-posting', [ReportController::class, 'generateAttendancePostingReport']);
    Route::get('generation-employee-tax-application', [ReportController::class, 'generateEmployeeTaxApplicationReport']);
    Route::get('generation-employee-philhealth', [ReportController::class, 'generateEmployeePhilhealth']);
    Route::get('generation-employee-pagibig', [ReportController::class, 'generateEmployeePagibig']);
    Route::get('generation-attendance-monitoring', [ReportController::class, 'generateMonitoringAttendance']);
    Route::get('generation-manpower-list', [ReportController::class, 'generateManpowerList']);


    Route::get('generation-hdmf-loan', [ReportController::class, 'generateHdmfLoan']);
    Route::get('generation-employee-sss', [ReportController::class, 'generateEmployeesss']);
    Route::get('generation-employee-flags', [ReportController::class, 'generateEmployeeFlags']);
    Route::get('generation-employee-deductions', [ReportController::class, 'generateEmployeeDeductions']);
    Route::get('generation-employee-adjustments', [ReportController::class, 'generateEmployeeAdjustments']);
    Route::get('generation-employee-loans', [ReportController::class, 'generateEmployeeLoans']);
    Route::get('generation-payroll-summary', [ReportController::class, 'generatePayrollSummary']);
    Route::get('generation-benefits-and-other-income', [ReportController::class, 'generateBenefitsAndOtherIncome']);
    Route::get('generation-age-distribution-by-gender', [ReportController::class, 'generateAgeDistributionByGender']);
    Route::get('generation-thirteenth-month-pay', [ReportController::class, 'generateThirteenthMonthPay']);
    Route::post('generation-alphalist-1604c', [ReportController::class, 'generateAlphalist1604C']);


    // Report Generation
    // Route::get('report-generation', [ReportController::class, 'generateReport']);

    Route::get('processed-records',[AttendancePostingController::class, 'getProcessedRecords']);
    Route::put('edit-timelog',[AttendancePostingController::class, 'updateTimelog']);
    Route::get('timelog-edits',[TimelogEditController::class, 'index']);
    Route::put('timelog-edits/{id}',[TimelogEditController::class, 'approve']);
    Route::delete('timelog-edits/{id}',[TimelogEditController::class, 'destroy']);
    Route::get('attendance-posting-timelog-records',[AttendancePostingController::class, 'getTimelogRecords']);

    // Imports
    Route::prefix('import')->group(function () {
        Route::post('timelogs', [ImportController::class, 'import_timelogs']);
        Route::post('employees', [ImportController::class, 'import_employees']);
        Route::post('old_payroll', [ImportController::class, 'import_old_payroll']);
    });

    // Biometric Connection Notification
    Route::get('biometric-notification',[BiometricNotificationController::class, 'index']);

    // Created Migration
    Route::get('migrateShields',[TaxTableController::class, 'getShields']);

    // Viber
    Route::get('viber-web-hook',[ViberWebHookController::class, 'index']);

    // Get TITO or WFH for Offset Earning
    Route::get('timekeeping-list/offset-earning-tito-checker',[EmployeeOffsetEarningController::class, 'getTitoOrWFH']);

    // routes/api.php
    // Route::get('/rooms', [RoomController::class, 'index']);
    // Route::post('/rooms', [RoomController::class, 'create']);
    // Route::get('/rooms/{room}', [RoomController::class, 'show']);
    // Route::post('/rooms/{room}/join', [RoomController::class, 'join']);
    // Route::post('/rooms/{room}/leave', [RoomController::class, 'leave']);
    // Route::put('/rooms/{room}', [RoomController::class, 'update']);
    // Route::delete('/rooms/{room}', [RoomController::class, 'destroy']);
    // Route::get('/rooms/{room}/participants', [RoomController::class, 'participants']);

    /**copy role access */
    Route::post('copy-role-access',[RoleController::class, 'copyRoleAccess']);
    Route::get('/report-modules/list',[ReportModuleController::class, 'listByCategory']);
});

// Route::group(['prefix' => 'v1'], function () {
    // Public leave action API routes
    Route::prefix('/leave')->group(function () {
        Route::get('/{leave}/approve/{approver}', [PublicLeaveController::class, 'approve'])
            ->name('api.leave.public.approve');
        Route::get('/{leave}/deny/{approver}', [PublicLeaveController::class, 'deny'])
            ->name('api.leave.public.deny');
        Route::get('/{leave}/view/{viewer}', [PublicLeaveController::class, 'view'])
            ->name('api.leave.public.view');
        Route::post('/{leave}/process/{approver}', [PublicLeaveController::class, 'process'])
            ->name('api.leave.public.process');
    });

    Route::prefix('/overtime')->group(function () {
        Route::get('/{overtime}/approve/{approver}', [PublicOvertimeController::class, 'approve'])
            ->name('api.overtime.public.approve');
        Route::get('/{overtime}/deny/{approver}', [PublicOvertimeController::class, 'deny'])
            ->name('api.overtime.public.deny');
        Route::get('/{overtime}/view/{viewer}', [PublicOvertimeController::class, 'view'])
            ->name('api.overtime.public.view');
        Route::post('/{overtime}/process/{approver}', [PublicOvertimeController::class, 'process'])
            ->name('api.overtime.public.process');
    });

    Route::prefix('/ob')->group(function () {
        Route::get('/{ob}/approve/{approver}', [PublicObController::class, 'approve'])
            ->name('api.ob.public.approve');
        Route::get('/{ob}/deny/{approver}', [PublicObController::class, 'deny'])
            ->name('api.ob.public.deny');
        Route::get('/{ob}/view/{viewer}', [PublicObController::class, 'view'])
            ->name('api.ob.public.view');
        Route::post('/{ob}/process/{approver}', [PublicObController::class, 'process'])
            ->name('api.ob.public.process');
    });

    Route::prefix('/undertime')->group(function () {
        Route::get('/{undertime}/approve/{approver}', [PublicUndertimeController::class, 'approve'])
            ->name('api.undertime.public.approve');
        Route::get('/{undertime}/deny/{approver}', [PublicUndertimeController::class, 'deny'])
            ->name('api.undertime.public.deny');
        Route::get('/{undertime}/view/{viewer}', [PublicUndertimeController::class, 'view'])
            ->name('api.undertime.public.view');
        Route::post('/{undertime}/process/{approver}', [PublicUndertimeController::class, 'process'])
            ->name('api.undertime.public.process');
    });

    Route::get('/time-adjustment/public/{timeAdjustment}/approve/{approver}', [PublicTimeAdjustmentController::class, 'approve'])
        ->name('api.time-adjustment.public.approve');
    Route::get('/time-adjustment/public/{timeAdjustment}/deny/{approver}', [PublicTimeAdjustmentController::class, 'deny'])
        ->name('api.time-adjustment.public.deny');
    Route::get('/time-adjustment/public/{timeAdjustment}/view/{viewer}', [PublicTimeAdjustmentController::class, 'view'])
        ->name('api.time-adjustment.public.view');
    Route::post('/time-adjustment/public/{timeAdjustment}/process/{approver}', [PublicTimeAdjustmentController::class, 'process'])
        ->name('api.time-adjustment.public.process');

    Route::prefix('ai')->group(function () {
        // Health check
        Route::get('health', [AiController::class, 'health']);

        // Chat endpoints
        Route::post('generate', [AiController::class, 'generate']);
        Route::post('ask-with-context', [AiController::class, 'askWithContext']);

        // Document management
        Route::get('documents', [AiController::class, 'listDocuments']);
        Route::post('documents/upload', [AiController::class, 'uploadDocument']);
        Route::get('documents/{id}', [AiController::class, 'getDocument']);
        Route::delete('documents/{id}', [AiController::class, 'deleteDocument']);

        // RAG features
        Route::get('statistics', [AiController::class, 'getStatistics']);
        Route::post('search', [AiController::class, 'searchSimilar']);
    });

    Route::get('v1/check-email-existed', [EmployeeController::class, 'checkEmailExisted']);
    Route::get('v1/check-email-employee-id-same', [EmployeeController::class, 'checkEmailEmployeeIdSame']);
    Route::get('v1/forgotPassword', [UserController::class, 'forgotPassword']);

// });
