<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\View\DashboardRedirectController;

Route::redirect('/', '/api/docs')->name('docs.home');
Route::view('/api/docs', 'docs.swagger')->name('docs.swagger');
Route::get('/dashboard', [DashboardRedirectController::class, 'dashboard'])->name('dashboard.redirect');

Route::get('/api/documentation/swagger.json', function () {
    $path = resource_path('docs/openapi.json');
    abort_unless(is_file($path), 404);

    return response()->file($path, [
        'Content-Type' => 'application/json',
        'Cache-Control' => 'public, max-age=300',
    ]);
})->name('docs.swagger-json');
