Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"

$appData = $env:APPDATA
$localAppData = $env:LOCALAPPDATA
if ([string]::IsNullOrWhiteSpace($appData)) {
    $appData = Join-Path $HOME "AppData\\Roaming"
}
if ([string]::IsNullOrWhiteSpace($localAppData)) {
    $localAppData = Join-Path $HOME "AppData\\Local"
}

$storageRoot = Join-Path $appData "IuVeConnectAgent"
$installRoot = Join-Path $localAppData "IuVeConnectAgent"

if (Test-Path $installRoot) {
    Remove-Item -Path $installRoot -Recurse -Force
}
if (Test-Path $storageRoot) {
    Remove-Item -Path $storageRoot -Recurse -Force
}

@{
    ok = $true
    adapter = "windows"
    mode = "skeleton"
    removed_install_root = $installRoot
    removed_storage_root = $storageRoot
    service_uninstall = "disabled"
} | ConvertTo-Json -Depth 5 -Compress
