<?php
declare(strict_types=1);

require_once dirname(__DIR__) . '/_bootstrap.php';

golder_require_method('POST');
$ctx = golder_api_auth('desktop_sync');
$input = golder_api_input();

$deviceId = (int)($input['device_id'] ?? 0);
if ($deviceId <= 0) {
    golder_json_response(['status' => 'error', 'message' => 'device_id is required'], 400);
}

$ok = golder_remove_device($ctx['master'], (int)$ctx['customer_id'], $deviceId);
if (!$ok) {
    golder_json_response(['status' => 'error', 'message' => 'Device not found'], 404);
}

golder_json_response(['status' => 'ok']);


