@echo off
:ROOMCONFIGSELECT
cls
echo Select the configuration to apply:
echo.

setlocal enabledelayedexpansion
set count=0
for /f "tokens=1,2,3 delims=," %%a in (CustomerConfigs\CustomerInfo.csv) do (
    set /a count+=1
    echo !count! - %%a
    set config[!count!]=%%a,%%b,%%c
)

set choice=
set /p choice=Enter your choice number: 

if not defined choice goto menu
if %choice% gtr %count% goto menu
if %choice% lss 1 goto menu

set selectedConfig=!config[%choice%]!
echo Selected configuration: %selectedConfig%

for /f "tokens=1,2,3 delims=," %%a in ("%selectedConfig%") do (
    set email=%%a
    set password=%%b
    set dualScreen=%%c
)

for /f "tokens=1,2 delims=," %%a in ("%selectedConfig%") do (
    set email=%%a
    set password=%%b
)

powershell -ExecutionPolicy Bypass -File "backend\generate_xml.ps1" -Email "%email%" -Password "%password%" -DualScreen "%dualScreen%"
pause
