<?php
// catalog/paises.php — Lista todos los países disponibles
declare(strict_types=1);
require_once dirname(__FILE__) . '/../config.php';
$db   = getDB();
$stmt = $db->query('SELECT idpais AS id, descripcion AS nombre FROM pais ORDER BY descripcion ASC');
$rows = $stmt->fetchAll();
foreach ($rows as &$r) {
    $r['id'] = (int)$r['id'];
}
unset($r);
jsonOk(['paises' => $rows]);
