<?php
require_once "../config/Conexion.php";

$tables = ["atencion", "persona", "usuario", "servicio"];
$results = [];

foreach ($tables as $t) {
    $res = ejecutarConsulta("SHOW COLUMNS FROM $t");
    if ($res) {
        $cols = [];
        while ($row = $res->fetch_assoc()) {
            $cols[] = $row['Field'];
        }
        $results[$t] = $cols;
    } else {
        $results[$t] = "ERROR: Table not found or access denied";
    }
}

header('Content-Type: application/json');
echo json_encode($results, JSON_PRETTY_PRINT);
?>
