# RefDrop Windows Uninstaller
# Removes the NativeMessaging host registration and helper app files.

$ErrorActionPreference = "Stop"

$InstallDir = "$env:LOCALAPPDATA\RefDrop"
$RegKey     = "HKCU:\Software\Google\Chrome\NativeMessagingHosts\com.refdrop.helper"

# 1. Remove Chrome NativeMessaging registry key
Write-Host "  [1/2] Removing Chrome registration..." -ForegroundColor Gray
if (Test-Path $RegKey) {
    Remove-Item -Path $RegKey -Force
    Write-Host "  [1/2] Done" -ForegroundColor Green
} else {
    Write-Host "  [1/2] Already removed" -ForegroundColor Yellow
}

# 2. Remove install directory
Write-Host "  [2/2] Removing helper files..." -ForegroundColor Gray
if (Test-Path $InstallDir) {
    Remove-Item -Path $InstallDir -Recurse -Force
    Write-Host "  [2/2] Done" -ForegroundColor Green
} else {
    Write-Host "  [2/2] Already removed" -ForegroundColor Yellow
}
