@echo off
echo ========================================
echo Personal UPI Setup Helper
echo ========================================
echo.

REM Check if .env exists
if not exist .env (
    echo Creating .env file from env.example...
    copy env.example .env
    echo.
)

echo Please enter your personal UPI ID:
echo Examples: 9876543210@ybl, yourname@paytm, yourname@oksbi
echo.
set /p UPI_ID="Your UPI ID: "

echo.
echo Adding PHONEPE_UPI_ID to .env file...
echo.

REM Check if PHONEPE_UPI_ID already exists
findstr /C:"PHONEPE_UPI_ID" .env >nul 2>&1
if %errorlevel% equ 0 (
    echo Updating existing PHONEPE_UPI_ID...
    powershell -Command "(Get-Content .env) -replace '^PHONEPE_UPI_ID=.*', 'PHONEPE_UPI_ID=%UPI_ID%' | Set-Content .env"
) else (
    echo Adding new PHONEPE_UPI_ID...
    echo. >> .env
    echo # Personal UPI Configuration >> .env
    echo PHONEPE_UPI_ID=%UPI_ID% >> .env
)

echo.
echo ========================================
echo SUCCESS! Configuration Updated
echo ========================================
echo.
echo Your UPI ID has been set to: %UPI_ID%
echo.
echo Next steps:
echo 1. Restart your backend server
echo 2. Open the Flutter app
echo 3. Go to Pay Installment
echo 4. Select "Pay via QR Code"
echo 5. You should see your UPI ID
echo.
echo ========================================
echo.
pause

