<?php
header('Content-Type: application/json');
require_once __DIR__ . '/../config/db.php';
$pdo = getDBConnection();

try {
    // We want the 4 main branches in specific order or just all except Bodega (ID 1)
    $stmt = $pdo->query("SELECT id, nombre FROM sucursales WHERE id != 1 ORDER BY id ASC");
    $branches = $stmt->fetchAll(PDO::FETCH_ASSOC);
    echo json_encode($branches);
} catch (Exception $e) {
    echo json_encode([]);
}
?>
