<?php

use Illuminate\Support\Facades\Route;
use App\Modules\HR\Attendance\Http\Controllers\AttendanceApiController;

/*
|--------------------------------------------------------------------------
| Attendance API Routes
|--------------------------------------------------------------------------
|
| These routes are loaded by the AttendanceServiceProvider within a group
| which is assigned the "api" middleware group.
|
*/

Route::prefix('attendance')
    ->name('api.attendance.')
    ->group(function () {

        // Ingest attendance data (Public for webhooks)
        Route::post('ingest', [AttendanceApiController::class, 'ingest'])
            ->name('ingest');

        // Protected routes
        Route::middleware(['auth:sanctum'])->group(function () {
            // Get available settings
            Route::get('settings', [AttendanceApiController::class, 'settings'])
                ->name('settings');

            // Get import status
            Route::get('import/{id}', [AttendanceApiController::class, 'importStatus'])
                ->name('import.status');
        });
    });
