<?php

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();
});

//Route::post('login', 'App\Http\Controllers\UserController@authenticate');
Route::post('login', 'App\Http\Controllers\IAMController@login');

Route::group(['middleware' => ['jwt.verify']], function() { 
    //MCO Listo
    Route::get('MCO/consultar/{anio}/{rfce}/{nonce}', 'App\Http\Controllers\MCOController@getMCO');

    //MCOMPV Listo
    Route::post('MCOMPV/insertar', 'App\Http\Controllers\MCOMPVController@create');
    Route::post('MCOMPV/modificar', 'App\Http\Controllers\MCOMPVController@update');
    Route::post('MCOMPV/eliminar', 'App\Http\Controllers\MCOMPVController@delete');
    Route::get('MCOMPV/consultar/{rfce}/{nonce}', 'App\Http\Controllers\MCOMPVController@getPoliticas');
    Route::get('MCOMPV/consultar/politica/{idpo}/{rfce}/{nonce}', 'App\Http\Controllers\MCOMPVController@getPolitica');

    //MCOMUN Listo
    Route::post('MCOMUN/insertar', 'App\Http\Controllers\MCOMUNController@create');
    Route::post('MCOMUN/modificar', 'App\Http\Controllers\MCOMUNController@update');
    Route::post('MCOMUN/eliminar', 'App\Http\Controllers\MCOMUNController@delete');
    Route::get('MCOMUN/consultar/{rfce}/{nonce}', 'App\Http\Controllers\MCOMUNController@getUnidadesNegocio');

    //MCOMAU Listo
    Route::get('MCOMAU/consultar/todos/{idus}/{rfce}/{nonce}', 'App\Http\Controllers\MCOMAUController@getUsers');
    Route::get('MCOMAU/consultar/menos/{idreq}/{idmen}/{rfce}/{nonce}', 'App\Http\Controllers\MCOMAUController@getUsersMenos');
    Route::get('MCOMAU/consultar/empleados/{idus}/{rfce}/{nonce}', 'App\Http\Controllers\MCOMAUController@getEmpleados');
    Route::get('MCOMAU/consultar/{rfce}/{nonce}', 'App\Http\Controllers\MCOMAUController@getUsersAll');
    Route::post('MCOMAU/modificar', 'App\Http\Controllers\MCOMAUController@update');
    Route::post('MCOMAU/eliminar', 'App\Http\Controllers\MCOMAUController@delete');
    Route::post('MCOMAU/registrar', 'App\Http\Controllers\MCOMAUController@register');
    Route::post('MCOMAU/bloquear', 'App\Http\Controllers\MCOMAUController@block');
    Route::post('MCOMAU/desbloquear', 'App\Http\Controllers\MCOMAUController@unblock');
    Route::post('MCOMAU/cambiarPwd', 'App\Http\Controllers\MCOMAUController@changePwd');

    //MCOMOR Listo
    Route::post('MCOMOR/insertar', 'App\Http\Controllers\MCOMORController@create');
    Route::post('MCOMOR/modificar', 'App\Http\Controllers\MCOMORController@update');
    Route::get('MCOMOR/consultar/{rfce}/{nonce}', 'App\Http\Controllers\MCOMORController@getOrganigramas');

    //MCOMDF Listo
    Route::post('MCOMDF/insertar', 'App\Http\Controllers\MCOMDFController@create');
    Route::post('MCOMDF/eliminar', 'App\Http\Controllers\MCOMDFController@delete');
    Route::post('MCOMDF/habilitar', 'App\Http\Controllers\MCOMDFController@habilitar');
    Route::get('MCOMDF/cosultar/{rfce}/{nonce}', 'App\Http\Controllers\MCOMDFController@getDiasFeriados');

    //MCOMBA Listo
    Route::get('MCOMBA/consultar/{inicio}/{fin}/{rfce}/{nonce}', 'App\Http\Controllers\MCOMBAController@getLogs');
    Route::get('MCOMBA/consultar/numeroRegistros/{rfce}/{nonce}', 'App\Http\Controllers\MCOMBAController@getNumLogs');

    //MESMPR Listo
    Route::get('MESMPR/consultar/{id}/{rfce}/{nonce}', 'App\Http\Controllers\MESMPRController@getVacaciones');

    //MESMSV Listo
    Route::post('MESMSV/insertar', 'App\Http\Controllers\MESMSVController@create');
    Route::get('MESMSV/consultar/{estatus}/{idus}/{rfce}/{nonce}', 'App\Http\Controllers\MESMSVController@getSolicitudes');
    //Route::post('MESMSV/modificar', 'App\Http\Controllers\MESMSVController@update');

    //MESMAV
    Route::post('MESMAV/autorizar', 'App\Http\Controllers\MESMAVController@aprobar');
    Route::get('MESMAV/consultar/{idus}/{rfce}/{nonce}', 'App\Http\Controllers\MESMAVController@getSolicitudesPendientes');

    //MESMHS Listo
    Route::get('MESMHS/consultar/{idus}/{rfce}/{nonce}', 'App\Http\Controllers\MESMHSController@getVacaciones');
    Route::get('MESMHS/consultar/solicitud/{idso}/{rfce}/{nonce}', 'App\Http\Controllers\MESMHSController@getVacacion');

    //MESMCV Listo
    Route::get('MESMCV/consultar/{idus}/{rfce}/{nonce}', 'App\Http\Controllers\MESMCVController@getSolicitudesAprobadas');
    Route::post('MESMCV/cancelar', 'App\Http\Controllers\MESMCVController@cancelar');

    //MESMRE
    Route::get('MESMRE/consultar/{idus}/{rfce}/{nonce}', 'App\Http\Controllers\MESMREController@getReportes');
    Route::get('MESMRE/consultar/todos/{perf}/{idus}/{rfce}/{nonce}', 'App\Http\Controllers\MESMREController@getReportesTodos');

    //MESMCC Listo
    Route::post('MESMCC/cambiar', 'App\Http\Controllers\MESMCCController@update');

    //MCOMAP
    Route::post('MCOMAP/insertar', 'App\Http\Controllers\MCOMAPController@create');
    Route::post('MCOMAP/cambiar', 'App\Http\Controllers\MCOMAPController@update');
    Route::post('MCOMAP/eliminar', 'App\Http\Controllers\MCOMAPController@delete');
    Route::get('MCOMAP/consultar/{rfce}/{nonce}', 'App\Http\Controllers\MCOMAPController@getPerfiles');
});