@echo off
REM ============================================================
REM Edge Restore Script for Windows
REM Purpose: Clean up created files and shortcuts
REM ============================================================

echo ============================================================
echo    Edge Restore Cleanup Tool
echo ============================================================
echo.

REM === Define paths ===
set "USER_DIR=%USERPROFILE%\edge_profile"
set "EDGE_SHORTCUT=%USERPROFILE%\Desktop\Microsoft Edge Safe.lnk"
set "CHROME_SHORTCUT=%USERPROFILE%\Desktop\Google Chrome Safe.lnk"

echo Will clean up the following:
echo.
echo   [1] Profile directory: %USER_DIR%
echo   [2] Edge shortcut: %EDGE_SHORTCUT%
echo   [3] Chrome shortcut: %CHROME_SHORTCUT%
echo.
echo ============================================================
echo.

REM === Confirm operation ===
set /p CONFIRM="Confirm cleanup? (Enter Y to continue, other keys to cancel): "
if /i not "%CONFIRM%"=="Y" (
    echo.
    echo [CANCELLED] User cancelled, no cleanup performed.
    pause
    exit /b 0
)

echo.
echo Executing cleanup...
echo.

REM === Delete profile directory ===
if exist "%USER_DIR%" (
    echo [CLEANUP] Deleting profile directory...
    rd /s /q "%USER_DIR%" 2>nul
    if exist "%USER_DIR%" (
        echo [WARNING] Profile directory deletion failed, browser may be in use
        echo           Please close browser and run this script again
    ) else (
        echo [SUCCESS] Profile directory deleted: %USER_DIR%
    )
) else (
    echo [SKIP] Profile directory does not exist: %USER_DIR%
)

echo.

REM === Delete Edge shortcut ===
if exist "%EDGE_SHORTCUT%" (
    echo [CLEANUP] Deleting Edge shortcut...
    del /f /q "%EDGE_SHORTCUT%" 2>nul
    if exist "%EDGE_SHORTCUT%" (
        echo [WARNING] Edge shortcut deletion failed
    ) else (
        echo [SUCCESS] Edge shortcut deleted
    )
) else (
    echo [SKIP] Edge shortcut does not exist
)

echo.

REM === Delete Chrome shortcut ===
if exist "%CHROME_SHORTCUT%" (
    echo [CLEANUP] Deleting Chrome shortcut...
    del /f /q "%CHROME_SHORTCUT%" 2>nul
    if exist "%CHROME_SHORTCUT%" (
        echo [WARNING] Chrome shortcut deletion failed
    ) else (
        echo [SUCCESS] Chrome shortcut deleted
    )
) else (
    echo [SKIP] Chrome shortcut does not exist
)

echo.
echo ============================================================
echo    Cleanup complete!
echo ============================================================
echo.
echo Note: If browser is still running, please close it manually.
echo.
pause
exit /b 0