@echo off
setlocal

set "SCRIPT_DIR=%~dp0"
set "UNINSTALL_PS1=%SCRIPT_DIR%lib\uninstall.ps1"

if not exist "%UNINSTALL_PS1%" (
    echo ERROR: uninstall script not found: "%UNINSTALL_PS1%"
    exit /b 1
)

powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%~dp0lib\uninstall.ps1"
set "EXIT_CODE=%ERRORLEVEL%"

if not "%EXIT_CODE%"=="0" (
    echo ERROR: uninstall failed with exit code %EXIT_CODE%.
    exit /b %EXIT_CODE%
)

exit /b 0
