<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\AuthController;
use App\Http\Controllers\DashboardController;
use App\Http\Controllers\EmpresaController;
use App\Http\Controllers\LicenciaController;
use App\Http\Controllers\ActivacionController;
use App\Http\Controllers\PagoController;
use App\Http\Controllers\ConfiguracionController;

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

// Protegidas
Route::middleware('auth')->group(function () {
    Route::get('/dashboard', [DashboardController::class, 'index'])->name('dashboard');
    
    Route::resource('empresas', EmpresaController::class);
        Route::post('licencias/{id}/estado/{estado}', [LicenciaController::class, 'cambiarEstado'])->name('licencias.estado');
    Route::resource('licencias', LicenciaController::class);
    Route::resource('activaciones', ActivacionController::class)->only(['index', 'show']);
    Route::resource('pagos', PagoController::class);
    Route::resource('configuracion', ConfiguracionController::class)->only(['index', 'store']);
});
