<?php

require_once __DIR__ . '/../config/database.php';

if (!isset($_POST['workspace_id']) || empty($_POST['workspace_id'])) {
    echo "Missing workspace_id";
    exit;
}

$workspace_id = $_POST['workspace_id'];

$sql = "DELETE FROM questions WHERE workspace_id = :workspace_id";
$stmt = $pdo->prepare($sql);
$stmt->execute(['workspace_id' => $workspace_id]);

echo "Deleted " . $stmt->rowCount() . " question(s) for workspace: " . $workspace_id;