@echo off
title Sootrik - Windows Installer
echo ==============================================
echo       SOOTRIK - PC SETUP
echo ==============================================
echo.
echo Installing Sootrik Desktop App...
echo.

set APP_DIR=%LOCALAPPDATA%\Sootrik
if not exist "%APP_DIR%" mkdir "%APP_DIR%"

echo [1/3] Downloading App Icon...
powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; (New-Object Net.WebClient).DownloadFile('https://daily-order-track-1.emergent.host/favicon.ico', '%APP_DIR%\logo.ico')"

echo [2/3] Creating Desktop Shortcut...
powershell -Command "$ws = New-Object -ComObject WScript.Shell; $s = $ws.CreateShortcut('%USERPROFILE%\Desktop\Sootrik.lnk'); $edge = 'C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe'; if (-not (Test-Path $edge)) { $edge = 'C:\Program Files\Microsoft\Edge\Application\msedge.exe' }; $s.TargetPath = $edge; $s.Arguments = '--app=https://daily-order-track-1.emergent.host'; $s.IconLocation = '%APP_DIR%\logo.ico'; $s.Description = 'Sootrik - Order Management'; $s.Save()"

echo [3/3] Creating Start Menu Shortcut...
powershell -Command "$ws = New-Object -ComObject WScript.Shell; $programs = [Environment]::GetFolderPath('Programs'); $s = $ws.CreateShortcut(\"$programs\Sootrik.lnk\"); $edge = 'C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe'; if (-not (Test-Path $edge)) { $edge = 'C:\Program Files\Microsoft\Edge\Application\msedge.exe' }; $s.TargetPath = $edge; $s.Arguments = '--app=https://daily-order-track-1.emergent.host'; $s.IconLocation = '%APP_DIR%\logo.ico'; $s.Description = 'Sootrik - Order Management'; $s.Save()"

echo.
echo ==============================================
echo   SUCCESS! Sootrik Installed on your PC!
echo   Desktop par 'Sootrik' icon ban gaya hai.
echo ==============================================
echo.
echo Launching Sootrik...
timeout /t 2 >nul
start "" "%USERPROFILE%\Desktop\Sootrik.lnk"
exit
