<?php

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

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

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

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

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