#!/bin/bash

echo "========================================"
echo "  WiFi Billing System - XAMPP Setup"
echo "========================================"
echo

echo "Checking XAMPP services..."
echo

echo "Starting Backend API (Port 8000)..."
cd backend
gnome-terminal --title="WiFi Billing API" -- bash -c "npm start; exec bash" &
cd ..

echo
echo "Waiting 5 seconds for backend to start..."
sleep 5

echo "Starting Admin Panel (Port 3001)..."
cd admin-panel
gnome-terminal --title="WiFi Billing Admin" -- bash -c "npm start; exec bash" &
cd ..

echo
echo "========================================"
echo "  Services Started Successfully!"
echo "========================================"
echo
echo "Backend API: http://localhost:8000"
echo "Admin Panel: http://localhost:3001"
echo "Hotspot Portal: http://localhost:8000/api/hotspot/login"
echo
echo "Login Admin:"
echo "Username: admin"
echo "Password: admin123"
echo
echo "Press Enter to continue..."
read