<?php
require_once dirname(__DIR__) . '/_bootstrap.php';
$ctx = golder_api_auth('desktop_sync');
$input = golder_api_input();
$reqId = trim((string)($input['request_id'] ?? ''));

$st = $ctx['master']->prepare("SELECT status, barcode_data FROM remote_scan_requests WHERE id = ? AND customer_id = ?");
$st->execute([$reqId, $ctx['customer_id']]);
$row = $st->fetch();

if (!$row) {
    golder_json_response(['status' => 'error', 'message' => 'İstek bulunamadı'], 404);
}

golder_json_response(['status' => 'ok', 'scan_status' => $row['status'], 'barcode' => $row['barcode_data']]);


