<?php
require_once '../config/database.php';
secureSessionStart();
requireLogin();

$conn = getConnection();
$ticket_id = isset($_POST['ticket_id']) ? intval($_POST['ticket_id']) : 0;
$is_typing = isset($_POST['is_typing']) ? intval($_POST['is_typing']) : 0;

if ($ticket_id) {
    $query = "UPDATE support_tickets SET is_typing = '$is_typing' WHERE id = '$ticket_id'";
    mysqli_query($conn, $query);
}

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