@echo off
setlocal
title JEVAPOS Client Package Builder
for %%I in ("%~dp0..\..\php\php.exe") do set "PHP_EXE=%%~fI"
if not exist "%PHP_EXE%" (
    echo PHP was not found at "%PHP_EXE%".
    echo Run tools\build-client-release.php using your XAMPP php.exe.
    pause
    exit /b 1
)
echo Creating the CLIENT package. Your owner installation will not be changed.
echo 1. NEW INSTALLATION - includes jevapos.com folder and prepared client .env
echo 2. UPDATE - preserves the existing client's .env
choice /C 12 /N /M "Choose 1 or 2: "
if errorlevel 2 (
    "%PHP_EXE%" "%~dp0tools\build-client-release.php" --update
) else (
    "%PHP_EXE%" "%~dp0tools\build-client-release.php" --install
)
if errorlevel 1 (
    echo Do not distribute a package from this failed build.
    pause
    exit /b 1
)
echo.
echo Send only the newly created JEVAPOS-CLIENT ZIP from the folder opening now.
start "" explorer.exe "%~dp0outputs\client-releases"
pause
