false, 'ERROR' => 'missing_mac', 'MESSAGE' => 'MACAddress is required']); } $q = queryOne(" SELECT bh.ID AS BeaconHardwareID, bh.HardwareId AS MACAddress, bh.BusinessID, bh.ServicePointID, bh.ShardUUID AS UUID, bh.Major, bh.Minor, bh.Status, biz.Name AS BusinessName, sp.Name AS ServicePointName FROM BeaconHardware bh LEFT JOIN Businesses biz ON biz.ID = bh.BusinessID LEFT JOIN ServicePoints sp ON sp.ID = bh.ServicePointID WHERE bh.HardwareId = ? LIMIT 1 ", [$macAddress]); if (!$q || $q['Status'] !== 'assigned') { jsonResponse(['OK' => false, 'ERROR' => 'not_found']); } jsonResponse([ 'OK' => true, 'ERROR' => '', 'BEACON' => [ 'BeaconID' => (int) $q['BeaconHardwareID'], 'BusinessID' => (int) $q['BusinessID'], 'BusinessName' => $q['BusinessName'] ?? '', 'BeaconName' => $q['ServicePointName'] ?? '', 'UUID' => $q['UUID'] ?? '', 'MACAddress' => $q['MACAddress'], 'ServicePointName' => $q['ServicePointName'] ?? '', ], ]);