<?php
require_once '../../../config/database.php';
require_once '../../../config/auth.php';

requireRole(['admin', 'super_admin']);

$id = $_GET['id'] ?? 0;
$db = getDB();

try {
    $stmt = $db->prepare("DELETE FROM casing WHERE id = ?");
    $stmt->execute([$id]);
    
    $_SESSION['success'] = 'Data Casing berhasil dihapus!';
} catch (PDOException $e) {
    $_SESSION['error'] = 'Terjadi kesalahan saat menghapus data!';
}

header("Location: index.php");
exit;