# Remove Ninja Nexus POC files installed by this package only.
param(
  [string]$InstallRoot = $PSScriptRoot,
  [switch]$Force
)

$ErrorActionPreference = "Stop"

Write-Host "Ninja Nexus POC Uninstall" -ForegroundColor Cyan
Write-Host "This removes ONLY the POC folder contents — no registry or shell changes." -ForegroundColor Yellow

& (Join-Path $InstallRoot "STOP-NEXUS.ps1") -InstallRoot $InstallRoot

$appData = Join-Path $env:APPDATA "NinjaNexus"
$localData = Join-Path $env:LOCALAPPDATA "NinjaNexus"

if (-not $Force) {
  $answer = Read-Host "Delete session/audit data in AppData? (y/N)"
} else {
  $answer = "y"
}

if ($answer -eq "y") {
  if (Test-Path $appData) {
    Remove-Item -LiteralPath $appData -Recurse -Force
    Write-Host "Removed $appData"
  }
  if (Test-Path $localData) {
    Remove-Item -LiteralPath $localData -Recurse -Force
    Write-Host "Removed $localData"
  }
}

Write-Host ""
Write-Host "To remove the POC folder itself, delete:" -ForegroundColor Yellow
Write-Host "  $InstallRoot"
Write-Host "Uninstall script does not delete its own folder (safe default)." -ForegroundColor Yellow
