@echo off
echo ============================================
echo   BizNode - First Time Setup
echo ============================================
echo.

REM Check Python
python --version >nul 2>&1
if %errorlevel% neq 0 (
    echo [ERROR] Python not found.
    echo Please install Python 3.10+ from https://www.python.org/downloads/
    echo Make sure to tick "Add Python to PATH" during install.
    pause
    exit /b 1
)

REM Check Docker
docker --version >nul 2>&1
if %errorlevel% neq 0 (
    echo [WARNING] Docker not found or not running.
    echo Please install Docker Desktop from https://www.docker.com/products/docker-desktop/
    echo and make sure it is running before continuing.
    pause
)

echo [1/3] Installing Python packages (this may take 2-5 minutes)...
pip install -r requirements.txt
if %errorlevel% neq 0 (
    echo [ERROR] pip install failed.
    pause
    exit /b 1
)

echo.
echo [2/3] Checking Ollama and downloading default AI model (qwen3.5:4b)...
echo       This may download ~2-3 GB on first run - please wait...
python scripts/check_ollama.py
if %errorlevel% neq 0 (
    echo [WARNING] Ollama setup had issues. You can retry later by running:
    echo           python scripts/check_ollama.py
)

echo.
echo [3/3] Setup complete!
echo.
echo ============================================
echo   To start BizNode, run:  start.bat
echo   Or run:  python launcher.py
echo ============================================
pause
