#!/bin/bash
# Article Builder - Quick Start Server
# This script launches a local web server for development

echo "🚀 Article Builder - Starting local server..."
echo ""

# Check if Python 3 is available
if command -v python3 &> /dev/null; then
    echo "✅ Using Python 3"
    echo "📂 Server running at: http://localhost:8000"
    echo "🛑 Press Ctrl+C to stop"
    echo ""
    python3 -m http.server 8000
# Check if Python 2 is available
elif command -v python &> /dev/null; then
    echo "✅ Using Python 2"
    echo "📂 Server running at: http://localhost:8000"
    echo "🛑 Press Ctrl+C to stop"
    echo ""
    python -m SimpleHTTPServer 8000
# Check if PHP is available
elif command -v php &> /dev/null; then
    echo "✅ Using PHP"
    echo "📂 Server running at: http://localhost:8000"
    echo "🛑 Press Ctrl+C to stop"
    echo ""
    php -S localhost:8000
else
    echo "❌ No suitable server found!"
    echo ""
    echo "Please install one of the following:"
    echo "  - Python 3: https://www.python.org/downloads/"
    echo "  - Python 2: https://www.python.org/downloads/"
    echo "  - PHP: https://www.php.net/downloads"
    echo ""
    echo "Or use Node.js:"
    echo "  npx http-server -p 8000"
    exit 1
fi
