<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\ConcursoController; 
use Illuminate\Support\Facades\Auth;

Route::get('/', function () {
    return view('welcome');
});

// 2. Formulario Público (Inscripción)
Route::get('/participar', [ConcursoController::class, 'create'])->name('concurso.form');
Route::post('/participar', [ConcursoController::class, 'store'])->name('concurso.save');

// 3. Rutas de Autenticación
Auth::routes(['register' => false]);

// 4. Panel de Administración (Filtro por auth)
Route::middleware(['auth'])->group(function () {
    Route::get('/admin/postulantes', [ConcursoController::class, 'index'])->name('admin.index');
    Route::get('/admin/postulantes/{id}', [ConcursoController::class, 'show'])->name('admin.show');
    Route::delete('/admin/postulantes/{id}', [ConcursoController::class, 'destroy'])->name('admin.destroy');
});

Route::get('/gracias', function () {
    return view('concurso.gracias');
})->name('concurso.gracias');

// 5. Rutas de Contacto
Route::get('/contacto', [App\Http\Controllers\ContactoController::class, 'index'])->name('contacto.index');
Route::post('/contacto', [App\Http\Controllers\ContactoController::class, 'send'])->name('contacto.send');

// Esta es la que te falta para que el redirect()->route('contacto.gracias') no de error:
Route::get('/contacto/enviado', [App\Http\Controllers\ContactoController::class, 'gracias'])->name('contacto.gracias');