<?php

use App\Http\Controllers\Admin\EpisodeController;
use App\Http\Controllers\Admin\UserController;
use App\Http\Controllers\Admin\HomeController;
use App\Models\Episode;
use App\Models\Reservation;
use App\Models\Season;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Admin\SeasonController;
use App\Http\Controllers\Admin\ReservationController;

/*
|--------------------------------------------------------------------------
| 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 () {
    $seasons = Season::where('status', '=', 1)->orderby('number', 'asc')->get();
    $episodeHome = Episode::where('home', '=', 1)->first();
    $linkReservations = Reservation::where('link', '!=', '')->first();
    return view('home', compact('seasons', 'episodeHome', 'linkReservations'));
});

Route::get('/home', [\App\Http\Controllers\HomeController::class, 'index'])->name('home');

Route::get('/menu', [\App\Http\Controllers\HomeController::class, 'menu'])->name('menu');

Route::get('/menu/invitados', [\App\Http\Controllers\HomeController::class, 'invitados'])->name('invitados');

Auth::routes([

    'register' => false, // Register Routes...

    'reset' => false, // Reset Password Routes...

    'verify' => false, // Email Verification Routes...

]);

//Auth::routes();

Route::group(['prefix' => 'admin','middleware' => ['auth']], function(){
    Route::get('/', [HomeController::class, 'index']);
//    Route::resource('users', UserController::class);
    Route::resource('episodes', EpisodeController::class);
    Route::resource('seasons', SeasonController::class);
    Route::resource('reservations', ReservationController::class);
});
