<?php
// /app/public/index.php
require_once __DIR__ . '/../vendor/autoload.php';

use App\Config\Database;
use App\Services\AuthService;

$db = Database::conexion();
$auth = new AuthService($db);

if (!$auth->existeAlgunUsuario()) {
    header('Location: /setup.php');
    exit;
}

if ($auth->estaAutenticado()) {
    header('Location: /index_dashboard.php');
    exit;
}

header('Location: /login.php');
exit;