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

try {
    // Reset về trạng thái nhàn rỗi (idle)
    $conn->query("UPDATE cms_payment_display SET 
        payment_status = 'idle', 
        order_id = 0, 
        order_code = '', 
        customer_name = '', 
        customer_phone = '', 
        total_amount = 0 
    WHERE id = 1");
    
    echo json_encode(['status' => 'success', 'message' => 'State reset.']);
} catch (Exception $e) {
    echo json_encode(['status' => 'error', 'message' => $e->getMessage()]);
}
?>