<?php

require_once '../element/connection.php';

if (!isset($_SESSION['user_id'])) {
    exit();
}

$message_id = intval($_POST['message_id']);

// Update message status to delivered
mysqli_query($conn, "UPDATE support_messages SET status = 'delivered' WHERE id = '$message_id' AND sender_type = 'admin'");

echo json_encode(['success' => true]);
?>