<?php
session_start();
header('Content-Type: application/json');
include '../../config/db.php';

$campaign_id = intval($_GET['campaign_id'] ?? 0);

$rows = $conn->query("
SELECT * FROM vici_dispositions
WHERE (campaign_id = '$campaign_id' OR campaign_id = 0)
  AND active = 1
ORDER BY label ASC
");

$disps = [];
while($r = $rows->fetch_assoc()) $disps[] = $r;

echo json_encode(['success'=>true, 'dispositions'=>$disps]);
