<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Admin\ClientController;
use App\Http\Controllers\Admin\LicenseController;
use Illuminate\Support\Facades\Auth;

Route::get('/', function () {
    return redirect('/login');
});

Auth::routes(['register' => false]); // Desactivamos registro público por seguridad

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

// Grupo de rutas protegidas para el Administrador
Route::middleware(['auth'])->prefix('admin')->name('admin.')->group(function () {

    // CRUD Clientes
    Route::resource('clients', ClientController::class);

    // CRUD Licencias (Solo necesitamos listar, crear y guardar)
    Route::resource('licenses', LicenseController::class)->only(['index', 'create', 'store', 'destroy']);
});
