<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

require_once __DIR__ . "/modelos/Atencion.php";

echo "Running Atencion::listar()...\n";

try {
    $atencion = new Atencion();
    $rspta = $atencion->listar();

    if (!$rspta) {
        echo "Error: listar() returned false.\n";
    } else {
        echo "Rows found: " . $rspta->num_rows . "\n";
        while ($reg = $rspta->fetch_assoc()) {
            print_r($reg);
            break; // Show only first
        }
    }
} catch (Exception $e) {
    echo "Exception: " . $e->getMessage() . "\n";
}

echo "\n--------------------------------\n";
echo "Running Atencion::listarPlan()...\n";

try {
    $atencion = new Atencion();
    $rspta = $atencion->listarPlan();

    if (!$rspta) {
        echo "Error: listarPlan() returned false.\n";
    } else {
        echo "Rows found: " . $rspta->num_rows . "\n";
        while ($reg = $rspta->fetch_assoc()) {
            print_r($reg);
            break;
        }
    }
} catch (Exception $e) {
    echo "Exception: " . $e->getMessage() . "\n";
}
?>