@echo off
title DeployPro Installer
color 0B

echo.
echo  =============================================
echo   DeployPro Installer
echo  =============================================
echo.
echo  This will install DeployPro as a Windows service.
echo  Administrator privileges are required.
echo.

:: Check for admin
net session >nul 2>&1
if %errorLevel% NEQ 0 (
    echo  ERROR: Please right-click this file and choose "Run as administrator"
    echo.
    pause
    exit /b 1
)

:: Optional: prompt for install directory
set "INSTALL_DIR=C:\DeployPro"
set /p INSTALL_DIR="  Install to [%INSTALL_DIR%]: "
if "%INSTALL_DIR%"=="" set "INSTALL_DIR=C:\DeployPro"

echo.
echo  Starting installation to %INSTALL_DIR% ...
echo.

:: Run PowerShell installer
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%~dp0setup.ps1" "%INSTALL_DIR%"

if %errorLevel% NEQ 0 (
    echo.
    echo  Installation encountered errors. Check the output above.
    pause
    exit /b 1
)

echo.
pause
