@echo off
REM ============================================================================
REM  Icevyy TCG Bot — one-click launcher
REM  Double-click this to start EVERYTHING:
REM    1. starts the comp helper (npm start)
REM    2. the helper auto-opens Brave with your Cardladder login
REM    3. opens the app in your browser
REM  Leave the window that appears OPEN while you use the bot. Close it to stop.
REM ============================================================================
setlocal
cd /d "%~dp0"
title Icevyy TCG Bot  -  leave this window open

where node >nul 2>&1
if errorlevel 1 (
  echo Node.js is not installed or not on your PATH.
  echo Install it from https://nodejs.org then double-click this again.
  echo.
  pause
  exit /b 1
)

echo ============================================================
echo   Starting the Icevyy TCG bot...
echo.
echo   - Brave opens by itself. Log into Cardladder once if asked.
echo   - Your browser opens the app in a few seconds.
echo   - KEEP THIS WINDOW OPEN while you use the bot.
echo   - Close this window to stop the bot.
echo ============================================================
echo.

REM Open the app in the default browser once the server has had a moment to boot.
start "" powershell -NoProfile -WindowStyle Hidden -Command "Start-Sleep 6; Start-Process 'https://icevyytcg.netlify.app/'"

REM Start the helper. This also auto-launches Brave. Runs until you close the window.
call npm start

echo.
echo Bot stopped. You can close this window.
pause
