<?php

use App\Http\Controllers\ChoferController;
use App\Http\Controllers\DeudaController;
use App\Http\Controllers\GuardiaController;
use App\Http\Controllers\InicioController;
use App\Http\Controllers\LoginController;
use App\Http\Controllers\MantenimientoController;
use App\Http\Controllers\PagosController;
use App\Http\Controllers\VehiculoController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

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

//RUTAS CORRESPONDIENTE A AUTENTICACION
Route::post('/Login', [LoginController::class, 'LoginGetToken']);
Route::get('/perfil/{id}', [LoginController::class, 'PerfilSocio']);

//RUTAS CORRESPONDIENTE A CHOFER
Route::post('/CrearChofer', [ChoferController::class, 'crearChofer']);
Route::post('/insertarDocumentacion', [ChoferController::class, 'InsertarDocumentos']);
Route::post('/informeChofer', [ChoferController::class, 'InformeChoferes']);
Route::get('/listadochoferes/{id}', [ChoferController::class, 'ListadoChoferes']);
Route::get('/ListadoChoferesSinAsignacion/{id}', [ChoferController::class, 'ListadoChoferesSinAsignacion']);
Route::post('/saveDocumentos', [ChoferController::class, 'crearChofer']);

//OTRAS RUTAS UTILIZADAS
Route::get('/listarNacionalidades', [ChoferController::class, 'ListarNacionalida']);

//RUTAS CORRESPONDIENTE A UNIDADES
Route::get('/listaUnidadesSinAsignacion/{id}', [VehiculoController::class, 'ListarVehiculoDisponibles']);
Route::get('/listarUnidadxSocio/{id}', [VehiculoController::class, 'ListarUnidadxSocio']);


//RUTAS CORRESPONDIENTE A MANTENIMIENTO
Route::post('/savemantenimientos', [MantenimientoController::class, 'CreareMantenimiento']);
Route::post('/savecomprobante', [MantenimientoController::class, 'InsertarComprobante']);


//RUTAS CORRESPONDIENTE A ASIGNACION UNIDADES

Route::post('/actualizarChofer', [ChoferController::class, 'ActualizarChofer']);
Route::post('/actualizarImagenChofer', [ChoferController::class, 'ActualizarImagenes']);

//PAGOS Y DEUDAS SOLO SOCIOS
Route::post('/listarCabDeudas', [DeudaController::class, 'MisDeudasApp']);
Route::get('/listarDetDeudas/{id}', [DeudaController::class, 'MisDetallesDeudasApp']);
Route::post('/listarCabPagos', [PagosController::class, 'MisCabPagosApp']);
Route::get('/listarDetPagos/{id}', [PagosController::class, 'MisDetPagos']);

//LISTAS USADAS EN ENTRADAS Y SALIDAS DE UNIDAD
Route::get('/listarsalidaspendientes/{id}', [GuardiaController::class, 'ListarSalidaUnidad']);
Route::post('/grabasalidadunidad', [GuardiaController::class, 'CrearSalidaUnidad']);
Route::post('/grabaentradaunidad', [GuardiaController::class, 'CrearEntradaUnidad']);
Route::post('/save/configuracion', [GuardiaController::class, 'GrabaConfiguracion']);
Route::post('/listarAsignacion', [GuardiaController::class, 'listarAsignacion']);
Route::post('/listarGuardias', [GuardiaController::class, 'informeGuardias']);
Route::post('/listaerNovedades', [GuardiaController::class, 'informeNovedades']);
Route::post('/crear/guardias', [GuardiaController::class, 'CrearGuardia']);
Route::get('/listachoferesdisponibles/{id}', [ChoferController::class, 'ListaChoferesDisponibles']);
Route::get('/listar/asignacion/disponibles/{id}', [GuardiaController::class, 'listarAsignacionPendientes']);
Route::get('/datis/iniciales/{id}', [InicioController::class, 'DatosInicioApp']);
Route::get('/lista/configuracion/{id}', [GuardiaController::class, 'ConfiguracionApp']);
Route::post('/crear/novedades', [GuardiaController::class, 'CreateNovedad']);
Route::post('/listarMantenimientos', [MantenimientoController::class, 'ListaMantenimientos']);
//Route::middleware('auth:sanctum')->post('/ListarChoferes', [ChoferController::class, 'ListarChoferes']);
