<?php

use App\Http\Controllers\AnnexContractEmployeePdfController;
use App\Http\Controllers\ContractEmployeePdfController;
use App\Http\Controllers\HomeController;
use App\Http\Livewire\AssignController;
use App\Http\Livewire\CompaniesController;
use App\Http\Livewire\CompaniesUsersController;
use App\Http\Livewire\ContractDetailController;
use App\Http\Livewire\ContractsController;
use App\Http\Livewire\CvEmployeeController;
use App\Http\Livewire\CvEmployeeDetailsController;
use App\Http\Controllers\CvEmployeePdfController;
use App\Http\Controllers\DownloadController;
use App\Http\Livewire\BloqueadoController;
use App\Http\Livewire\Company_ContractsUsersController;
use App\Http\Livewire\Company_ContractsUsersCreateController;
use App\Http\Livewire\Company_ContractsUsersHistoryController;
use App\Http\Livewire\Company_ContractsUsersSignatureController;
use App\Http\Livewire\Company_JobPositionsController;
use App\Http\Livewire\Company_RegisterUsersController;
use App\Http\Livewire\DashboardController;
use App\Http\Livewire\Company_ConfigController;
use App\Http\Livewire\Company_EmployeeDetailController;
use App\Http\Livewire\Company_EmployeeProfileController;
use App\Http\Livewire\Company_EmployeesController;
use App\Http\Livewire\Company_EmployeesImportController;
use App\Http\Livewire\Company_EmployeeWorkCertificatesController;
use App\Http\Livewire\Company_EmployeeWorkPermitsController;
use App\Http\Livewire\Company_TypePsychotechnicsTestController;
use App\Http\Livewire\Company_WorkCertificatesController;
use App\Http\Livewire\Company_WorkPermitsController;
use App\Http\Livewire\Employee_ContractsController;
use App\Http\Livewire\Employee_ContractSignatureController;
use App\Http\Livewire\Employee_ProfileController;
use App\Http\Livewire\Employee_WorkCertificatesController;
use App\Http\Livewire\Employee_WorkPermitsController;
use App\Http\Livewire\NotificationsController;
use App\Http\Livewire\PermissionsController;
use App\Http\Livewire\PlansController;
use App\Http\Livewire\PublicHealthEntityController;
use App\Http\Livewire\RolesController;
use App\Http\Livewire\SettingsController;
use App\Http\Livewire\TypeWorkPermitController;
use App\Http\Livewire\UserProfileController;
use App\Http\Livewire\UsersController;
use App\Http\Controllers\TesterController;
use App\Http\Livewire\AnnexOthersController;
use App\Http\Livewire\Company_AnnexContractUserController;
use App\Http\Livewire\Company_AnnexContractUserHistoryController;
use App\Http\Livewire\Company_DocumentsTypeController;
use App\Http\Livewire\Company_ReportsController;
use App\Http\Livewire\Employee_ContractAnnexOthersController;
use App\Http\Livewire\Employee_DocumentsController;
use App\Http\Livewire\Employee_PaymentVouchersController;
use App\Http\Middleware\CheckStatus;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', function () {
    return view('auth.login');
})->name('login');



Auth::routes(["register" => false]);
Route::get('home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
Route::middleware(['auth'])->group(function () {
    Route::get('bloqueado', BloqueadoController::class)->name('bloqueado');


    Route::get('logout', [DashboardController::class, 'logout'])->name('logout');
    Route::middleware([CheckStatus::class])->group(function(){
        Route::get('/', DashboardController::class);
        Route::get('dashboard', DashboardController::class)->name('dashboard');
        Route::prefix('admin')->group(function () {
            Route::get('parametros',SettingsController::class)->name('parametros');
            Route::get('eps', PublicHealthEntityController::class)->name('eps');
            Route::get('tipos-permisos-laborales', TypeWorkPermitController::class)->name('tipos-permisos-laborales');
            Route::get('planes', PlansController::class)->name('planes');
            Route::get('empresas', CompaniesController::class)->name('empresas');
            Route::get('empresas/{id}', CompaniesUsersController::class)->name('empresas.usuarios');
            Route::get('cv', CvEmployeeController::class)->name('cv');
            Route::get('cv/{id}', CvEmployeeDetailsController::class)->name('cv.edit');
            //Route::group(['middleware' => ['can:Contracts_index']], function () {
            Route::get('contratos', ContractsController::class)->name('contratos');
            Route::get('contratos/{id}', ContractDetailController::class)->name('contratos.edit');
            Route::get('anexos-otros-si', AnnexOthersController::class)->name('anexos-otros-si');
            //});
        });
        Route::prefix('empresa')->group(function () {
            Route::get('configuracion-empresa', Company_ConfigController::class)->name('configuracion-empresa');
            Route::get('cargos', Company_JobPositionsController::class)->name('cargos');
            Route::get('permisos-laborales', Company_WorkPermitsController::class)->name('permisos-laborales');
            Route::get('certificados-laborales', Company_WorkCertificatesController::class)->name('certificados-laborales');
            Route::get('certificados-laborales-empleado/{id}', Company_EmployeeWorkCertificatesController::class)->name('certificados-laborales-empleado');
            Route::get('permisos-laborales-empleado/{id?}', Company_EmployeeWorkPermitsController::class)->name('permisos-laborales-empleado');
            Route::get('tipos-pruebas-psicotecnicas', Company_TypePsychotechnicsTestController::class)->name('tipos-pruebas-psicotecnicas');
            Route::get('tipos-documentos', Company_DocumentsTypeController::class)->name('tipos-documentos');
            Route::get('usuarios', Company_RegisterUsersController::class)->name('empresa.usuarios');
            Route::get('empleados', Company_EmployeesController::class)->name('empleados');
            Route::get('empleados/{id}', Company_EmployeeDetailController::class)->name('empleados.view');
            Route::get('importar-empleados', Company_EmployeesImportController::class)->name('importar-empleados');
            Route::get('hoja-de-vida', CvEmployeeController::class)->name('hoja-de-vida');
            Route::get('hoja-de-vida/{id}', CvEmployeeDetailsController::class)->name('hoja-de-vida.edit');
            Route::get('contratos-empleados', Company_ContractsUsersController::class)->name('contratos-empleados');
            Route::get('contratos-empleados/{id?}', Company_ContractsUsersCreateController::class,)->name('contratos-empleados.create');
            Route::get('cargo-empleado/{id?}', Company_EmployeeProfileController::class)->name('cargo-empleado');
            Route::get('contratos-empleados-firmar/{id?}', Company_ContractsUsersSignatureController::class)->name('contratos-empleados.firmar');
            Route::get('contratos-empleados-historial/{id?}/', Company_ContractsUsersHistoryController::class)->name('contratos-empleados.historial');
            Route::get('otro-si-contrato-empleado/{id?}', Company_AnnexContractUserController::class)->name('otro-si-contrato-empleado');
            Route::get('otros-si-contrato-empleado/{id?}', Company_AnnexContractUserHistoryController::class)->name('otros-si-contrato-empleado');
            Route::get('informes-empleados', Company_ReportsController::class)->name('informes-empleados');
        });
        Route::prefix('empleado')->group(function () {
            Route::get('empleado-perfil', Employee_ProfileController::class)->name('empleado-perfil');
            Route::get('empleado-cv', CvEmployeeDetailsController::class)->name('empleado-cv');
            Route::get('empleado-contrato-firmar/{id?}', Employee_ContractSignatureController::class)->name('empleado-contrato-firmar');
            Route::get('empleado-contratos', Employee_ContractsController::class)->name('empleado-contratos');
            Route::get('empleado-contrato-otro-si/{id?}', Employee_ContractAnnexOthersController::class)->name('empleado-contrato-otro-si');
            Route::get('empleado-permisos-laborales', Employee_WorkPermitsController::class)->name('empleado-permisos-laborales');
            Route::get('empleado-certificados-laborales', Employee_WorkCertificatesController::class)->name('empleado-certificados-laborales');
            Route::get('empleado-documentos', Employee_DocumentsController::class)->name('empleado-documentos');
            Route::get('empleado-desprendibles-pagos', Employee_PaymentVouchersController::class)->name('empleado-desprendibles-pagos');
        });

        Route::get('perfil-usuario', UserProfileController::class)->name('perfil-usuario');
        Route::get('notificaciones', NotificationsController::class)->name('notificaciones');

        //pdf routes
        Route::get('hoja-de-vida/pdf/{id}', [CvEmployeePdfController::class, 'index']);
        //Route::get('hoja-de-vida/test/{id}', [CvEmployeePdfController::class, 'test']);
        Route::get('contrato-empleado/pdf/{id}', [ContractEmployeePdfController::class, 'index']);
        Route::get('anexos-contrato-empleado/pdf/{id}', [AnnexContractEmployeePdfController::class, 'index']);
        //Route::get('contrato-empleado/test/{id}', [ContractEmployeePdfController::class, 'test']);
        Route::get('descargar/certificado/{id}', [DownloadController::class, 'downloadCertificatePDF']);
        //Route::get('test/{id}', [TesterController::class, 'index']);

        Route::prefix('usuarios')->group(function () {
            Route::get('usuarios', UsersController::class)->name('usuarios');
            Route::get('roles', RolesController::class)->name('roles');
            Route::get('permisos', PermissionsController::class)->name('permisos');
            Route::get('asignar', AssignController::class)->name('asignar');
        });
    });
});
