@echo off
setlocal EnableExtensions
chcp 65001 >nul
title Matrixly Lead Qualifier - Install and Demo
cd /d "%~dp0"

echo.
echo   Matrixly Lead Qualifier
echo   One-click install and sample demo
echo.

where powershell >nul 2>&1
if errorlevel 1 (
    echo   PowerShell is required to run this demo on Windows.
    echo   It is included with Windows 10 and 11.
    echo.
    echo   If you are on an older PC, download the demo package again
    echo   or email anwar.chowdhury@matrixly.net
    echo.
    pause
    exit /b 1
)

set "LQ_FROM_BAT=1"
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%~dp0install-and-demo.ps1"
set "EXITCODE=%ERRORLEVEL%"

echo.
if not "%EXITCODE%"=="0" (
    echo   Something went wrong. Open demo-output.txt in this folder
    echo   for details, or email anwar.chowdhury@matrixly.net
) else (
    echo   Demo finished. Open demo-output.txt to see the scored leads
    echo   and sample outreach.
)
echo.
echo   Press any key to close this window...
pause >nul
exit /b %EXITCODE%
