<?php
require_once 'config.php';

checkAccess(['admin', 'programmer']);

$data = json_decode(file_get_contents("php://input"), true);

if (!isset($data['id'])) response(["error" => "ID faltante"], 400);

try {
    $stmt = $pdo->prepare("DELETE FROM assemblies WHERE id = ?");
    $stmt->execute([$data['id']]);
    response(["success" => true]);
} catch (PDOException $e) {
    response(["error" => $e->getMessage()], 500);
}
?>