@echo off
chcp 65001 >nul
setlocal
title YarMenu POS - Register in Windows Apps

set "INSTALL_DIR=%LOCALAPPDATA%\YarMenu\POS"
if not exist "%INSTALL_DIR%\yarmenu_pos.exe" (
    echo [ERROR] YarMenu POS is not installed in:
    echo %INSTALL_DIR%
    echo.
    echo Run Setup.bat first.
    pause
    exit /b 1
)

powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0register_windows_app.ps1" -InstallDir "%INSTALL_DIR%"
if errorlevel 1 (
    echo.
    echo [ERROR] Registration failed.
    pause
    exit /b 1
)

echo.
echo Done. Search for "YarMenu" in Start menu or Settings ^> Apps.
pause
