<?php

use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Artisan;
use App\Http\Controllers\NumerologyController;
use App\Http\Controllers\AuthController;

/*
|--------------------------------------------------------------------------
| Auth Routes
|--------------------------------------------------------------------------
*/

Route::get('/login', [AuthController::class, 'showLogin'])->name('login');
Route::post('/login', [AuthController::class, 'login']);
Route::post('/logout', [AuthController::class, 'logout'])->name('logout')->middleware('auth');

/*
|--------------------------------------------------------------------------
| Numerology Routes (protegidas con autenticación)
|--------------------------------------------------------------------------
*/

Route::middleware('auth')->group(function () {
    Route::get('/', [NumerologyController::class, 'index'])->name('numerology.index');
    Route::post('/numerology/analyze', [NumerologyController::class, 'analyze'])->name('numerology.analyze');
    Route::post('/numerology/generate-pdf', [NumerologyController::class, 'generatePdf'])->name('numerology.generate-pdf');
});

/*
|--------------------------------------------------------------------------
| Utility Routes
|--------------------------------------------------------------------------
*/

Route::get('/configClear', function () { Artisan::call('config:clear'); });
Route::get('/configCache', function () { Artisan::call('config:cache'); });
Route::get('/cacheClear',  function () { Artisan::call('cache:clear'); });
Route::get('/routeClear',  function () { Artisan::call('route:cache'); });
Route::get('/routeCache',  function () { Artisan::call('route:clear'); });
Route::get('/viewClear',   function () { Artisan::call('view:clear'); });
Route::get('/storageLink', function () { Artisan::call('storage:link'); });
