@echo off
title Uninstall Claude Proxy Control
REM ASCII only - see the note in Install.bat.
REM Exit code is checked here too: this file also used to print "Done."
REM whatever happened inside the elevated window.
setlocal
echo Removing Claude Proxy Control - please confirm the administrator prompt.
set CPC_HOME=%USERPROFILE%\.claude-proxy-control
set CPC_UNINST=%~dp0runtime\Uninstall-Product.ps1
if exist "%CPC_HOME%\Uninstall-Product.ps1" set CPC_UNINST=%CPC_HOME%\Uninstall-Product.ps1
if not exist "%CPC_UNINST%" goto :nofiles
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
  "$p = Start-Process -FilePath powershell -Verb RunAs -PassThru -ArgumentList @('-NoProfile','-ExecutionPolicy','Bypass','-File','%CPC_UNINST%'); $p.WaitForExit(); exit $p.ExitCode"
set RC=%ERRORLEVEL%
echo.
if not "%RC%"=="0" goto :failed
echo Done. Claude Proxy Control has been removed.
pause
exit /b 0

:nofiles
echo.
echo ERROR: Uninstall-Product.ps1 not found.
echo Looked here: %CPC_UNINST%
echo.
pause
exit /b 1

:failed
echo Uninstall did not finish (code %RC%).
echo Try again, or run runtime\Uninstall-Product.ps1 as administrator.
echo.
pause
exit /b %RC%
