<?php
header('Content-Type: application/json; charset=utf-8');
require_once 'db_connect.php';

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $lesson_id = $_POST['lesson_id'] ?? 0;
    
    if($lesson_id > 0) {
        $sql = "DELETE FROM archived_lessons WHERE id = ?";
        $stmt = $conn->prepare($sql);
        $stmt->bind_param("i", $lesson_id);
        if($stmt->execute()) {
            echo json_encode(['status' => 'success']);
        } else {
            echo json_encode(['status' => 'error', 'message' => $conn->error]);
        }
    } else {
        echo json_encode(['status' => 'error', 'message' => 'ID غير صالح']);
    }
}
?>