<?php

use Barryvdh\DomPDF\Facade\Pdf;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Str;

Route::get('/', function () {
    return view('welcome');
})->name('home');

Route::view('dashboard', 'dashboard')
    ->middleware(['auth', 'verified'])
    ->name('dashboard');

Route::get('/documentation/download-pdf', function () {
    $markdown = file_get_contents(base_path('documentation/documentation_api_logistics.md'));
    $htmlContent = Str::markdown($markdown);

    $html = view('pdf.documentation', ['content' => $htmlContent])->render();

    return Pdf::loadHTML($html)
        ->setPaper('a4')
        ->download('documentation_api_logistics.pdf');
})->name('documentation.download-pdf');

require __DIR__.'/settings.php';
