<?php
session_start();
require_once '../includes/config.php';

if (!isset($_SESSION['user_id']) || $_SESSION['role'] !== 'admin') {
    header("Location: ../auth/login.php");
    exit;
}

$id = $_GET['id'] ?? null;
if ($id) {
    $stmt = $pdo->prepare("DELETE FROM incident_reports WHERE id = ?");
    if ($stmt->execute([$id])) {
        header("Location: incident_reports.php?deleted=1");
        exit;
    } else {
        die("Error deleting incident.");
    }
} else {
    die("Invalid request.");
}
?>
