@echo off
echo Creating deployment package...
echo.

:: Create dist directory
rmdir /s /q dist 2>nul
mkdir dist

:: Copy essential files
copy index.js dist\
copy printer.js dist\
copy printer-detector.js dist\
copy routes.js dist\
copy config.js dist\
copy package.json dist\
copy package-lock.json dist\
copy .env.example dist\
copy install-service.js dist\

:: Create installers
echo Creating installers...

:: Windows installer
echo @echo off > dist\install-windows.bat
echo echo Installing Siraya Printer Service... >> dist\install-windows.bat
echo node install-service.js >> dist\install-windows.bat
echo pause >> dist\install-windows.bat

:: Universal installer
echo @echo off > dist\install.bat
echo powershell -ExecutionPolicy Bypass -File "install.ps1" >> dist\install.bat
echo pause >> dist\install.bat

:: PowerShell installer
echo # See install.ps1 content above > dist\install.ps1

:: Linux installer
echo '#!/bin/bash' > dist/install-linux.sh
echo 'echo "Installing Siraya Printer Service..."' >> dist/install-linux.sh
echo 'node install-service.js' >> dist/install-linux.sh
echo 'read -p "Press Enter to continue..."' >> dist/install-linux.sh

:: Create README
echo # Siraya Thermal Printer Service > dist\README.md
echo. >> dist\README.md
echo ## Quick Installation >> dist\README.md
echo. >> dist\README.md
echo - **Windows:** Double-click `install.bat` >> dist\README.md
echo - **Linux/Mac:** Run `sudo bash install-linux.sh` >> dist\README.md
echo. >> dist\README.md
echo ## Features >> dist\README.md
echo - Auto-detects USB/Network/Serial printers >> dist\README.md
echo - Runs as background service >> dist\README.md
echo - Web interface: http://localhost:5000 >> dist\README.md
echo - Auto-starts on boot >> dist\README.md

:: Package it
echo Creating ZIP package...
powershell Compress-Archive -Path dist\* -DestinationPath siraya-printer-service.zip -Force

echo ✅ Package created: siraya-printer-service.zip
echo 📦 Size: 
dir siraya-printer-service.zip

pause