#!/bin/bash
# Start DSS Admin UI for testing

echo "🚀 Starting DSS Admin UI..."
echo ""

# Check if virtual environment exists
if [ ! -d ".venv" ]; then
    echo "❌ Virtual environment not found. Run ./setup.sh first"
    exit 1
fi

# Activate virtual environment
source .venv/bin/activate

# Check if server is already running
if lsof -Pi :3456 -sTCP:LISTEN -t >/dev/null ; then
    echo "⚠️  Server already running on port 3456"
    echo ""
    echo "Open in browser: http://localhost:3456"
    echo ""
    echo "To stop: pkill -f 'python.*tools.api.server'"
    exit 0
fi

# Start the server
echo "Starting FastAPI server on http://localhost:3456"
echo ""
echo "📱 Admin UI: http://localhost:3456"
echo "⚙️  Settings: http://localhost:3456/#settings (Configure Figma & Claude API)"
echo "📊 Services: http://localhost:3456/#services"
echo "⚡ Quick Wins: http://localhost:3456/#quick-wins"
echo "💬 Chat: http://localhost:3456/#chat"
echo "📚 API Docs: http://localhost:3456/docs"
echo ""
echo "Press Ctrl+C to stop"
echo ""

cd tools/api && python -m uvicorn server:app --host 0.0.0.0 --port 3456 --reload
