param(
  [string]$BaseUrl = "http://127.0.0.1:8080",
  [string]$DeviceToken = "demo-token",
  [string]$DriverId = "demo-driver",
  [string]$VehicleNo = "SEOUL-12-3456",
  [double]$Latitude = 37.5665,
  [double]$Longitude = 126.9780
)

$ErrorActionPreference = "Stop"

$body = @{
  driverId = $DriverId
  vehicleNo = $VehicleNo
  latitude = $Latitude
  longitude = $Longitude
  accuracy = 12
  speed = 42
  heading = 90
  provider = "script"
  recordedAt = (Get-Date).ToUniversalTime().ToString("o")
} | ConvertTo-Json

Invoke-RestMethod `
  -Uri "$BaseUrl/api/v1/locations" `
  -Method Post `
  -Headers @{ "X-Device-Token" = $DeviceToken } `
  -ContentType "application/json" `
  -Body $body
