<?php
include 'conexion.php';

if (!isset($_GET['id_bodega'])) {
    echo json_encode([]);
    exit;
}

$id_bodega = intval($_GET['id_bodega']);

$query = "SELECT id_serie, serie, modelo FROM series WHERE id_bodega = $id_bodega";
$resultado = $conexion->query($query);

$series = [];
while ($fila = $resultado->fetch_assoc()) {
    $series[] = $fila;
}

echo json_encode($series);
?>
