@echo off
REM ============================================================================
REM EasyStream - Folder Sync Batch Wrapper
REM ============================================================================
REM This batch file runs the PowerShell sync script
REM
REM Usage:
REM   sync-to-docker-progs.bat           - One-time sync
REM   sync-to-docker-progs.bat watch     - Continuous monitoring
REM   sync-to-docker-progs.bat verbose   - Detailed output
REM ============================================================================

setlocal

set SCRIPT_DIR=%~dp0
set PS_SCRIPT=%SCRIPT_DIR%sync-to-docker-progs.ps1

REM Check if PowerShell script exists
if not exist "%PS_SCRIPT%" (
    echo ERROR: PowerShell script not found: %PS_SCRIPT%
    pause
    exit /b 1
)

REM Parse arguments
set ARGS=
if /i "%1"=="watch" set ARGS=-Watch
if /i "%1"=="verbose" set ARGS=-Verbose
if /i "%1"=="dryrun" set ARGS=-DryRun
if /i "%1"=="-w" set ARGS=-Watch
if /i "%1"=="-v" set ARGS=-Verbose

REM Run PowerShell script
echo Starting EasyStream folder sync...
echo.

powershell -ExecutionPolicy Bypass -File "%PS_SCRIPT%" %ARGS%

if errorlevel 1 (
    echo.
    echo ERROR: Sync failed!
    pause
    exit /b 1
)

echo.
echo Sync completed successfully!
if not "%1"=="watch" if not "%1"=="-w" pause

endlocal
