<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\AccionLogController;
use App\Http\Controllers\AdministradorController;
use App\Http\Controllers\AgendaController;
use App\Http\Controllers\AuthController;
use App\Http\Controllers\BajaController;
use App\Http\Controllers\BugController;
use App\Http\Controllers\ClienteController;
use App\Http\Controllers\ContenidoWebController;
use App\Http\Controllers\CredencialClienteController;
use App\Http\Controllers\CredencialProfesionalController;
use App\Http\Controllers\DiaController;
use App\Http\Controllers\DiaDeAtencionController;
use App\Http\Controllers\DiaPreferenciaController;
use App\Http\Controllers\DocumentacionClienteController;
use App\Http\Controllers\ErrorController;
use App\Http\Controllers\EstadoProfesionalController;
use App\Http\Controllers\EstadoTurnoController;
use App\Http\Controllers\FeriadoController;
use App\Http\Controllers\FormularioController;
use App\Http\Controllers\FotoBugController;
use App\Http\Controllers\FotoController;
use App\Http\Controllers\HorarioDeAtencionController;
use App\Http\Controllers\HorarioPreferenciaController;
use App\Http\Controllers\HorarioRecesoController;
use App\Http\Controllers\LogSeguridadController;
use App\Http\Controllers\ModalidadController;
use App\Http\Controllers\ModoVacacionesController;
use App\Http\Controllers\PersonaController;
use App\Http\Controllers\ProfesionController;
use App\Http\Controllers\ProfesionalController;
use App\Http\Controllers\ServicioController;
use App\Http\Controllers\TelefonoController;
use App\Http\Controllers\TurnoController;
use App\Http\Controllers\UbicacionController;
use App\Http\Controllers\UserController;

Route::middleware('api')->group(function () {
    Route::post('auth/login/cliente', [AuthController::class, 'loginCliente'])->middleware('throttle:login-cliente-api');
    Route::post('auth/login/personal', [AuthController::class, 'loginPersonal'])->middleware('throttle:login-personal-api');
    Route::post('auth/login', [AuthController::class, 'login'])->middleware('throttle:login-api-general');
    Route::post('auth/logout', [AuthController::class, 'logout']);

    // Rutas API Resource estándar
    Route::apiResource('accioneslogs', AccionLogController::class);
    Route::apiResource('administradores', AdministradorController::class);
    Route::apiResource('agendas', AgendaController::class);
    Route::apiResource('bajas', BajaController::class);
    Route::apiResource('bugs', BugController::class);
    Route::apiResource('clientes', ClienteController::class);
    Route::apiResource('contenidosweb', ContenidoWebController::class);
    Route::apiResource('credencialesclientes', CredencialClienteController::class);
    Route::apiResource('credencialesprofesionales', CredencialProfesionalController::class);
    Route::apiResource('dias', DiaController::class);
    Route::apiResource('diasdeatenciones', DiaDeAtencionController::class);
    Route::apiResource('diaspreferencias', DiaPreferenciaController::class);
    Route::apiResource('documentacionesclientes', DocumentacionClienteController::class);
    Route::apiResource('errores', ErrorController::class);
    Route::apiResource('estadosprofesionales', EstadoProfesionalController::class);
    Route::apiResource('estadosturnos', EstadoTurnoController::class);
    Route::apiResource('feriados', FeriadoController::class);
    Route::apiResource('formularios', FormularioController::class);
    Route::apiResource('fotosbugs', FotoBugController::class);
    Route::apiResource('fotos', FotoController::class);
    Route::apiResource('horariosatenciones', HorarioDeAtencionController::class);
    Route::apiResource('horariospreferencias', HorarioPreferenciaController::class);
    Route::apiResource('horariosrecesos', HorarioRecesoController::class);
    Route::apiResource('logseguridades', LogSeguridadController::class);
    Route::apiResource('modalidades', ModalidadController::class);
    Route::apiResource('modosvacaciones', ModoVacacionesController::class);
    Route::apiResource('personas', PersonaController::class);
    Route::apiResource('profesiones', ProfesionController::class);
    Route::apiResource('profesionales', ProfesionalController::class);
    Route::apiResource('servicios', ServicioController::class);
    Route::apiResource('telefonos', TelefonoController::class);
    Route::apiResource('turnos', TurnoController::class);
    Route::post('turnos/{turno}/confirmar', [TurnoController::class, 'confirmar']);
    Route::post('turnos/{turno}/cancelar', [TurnoController::class, 'cancelar']);
    Route::post('turnos/{turno}/reprogramar', [TurnoController::class, 'reprogramar']);
    Route::post('turnos/{turno}/cliente-ausente', [TurnoController::class, 'clienteAusente']);
    Route::post('turnos/{turno}/cliente-presente', [TurnoController::class, 'clientePresente']);
    Route::apiResource('ubicaciones', UbicacionController::class);
    Route::apiResource('users', UserController::class);
});
