#!/bin/bash
# Start FastAPI backend server

cd "$(dirname "$0")"

# Use explicit Python path to avoid Cursor interception
PYTHON_BIN="/usr/bin/python3"

if [ ! -f "$PYTHON_BIN" ]; then
    echo "❌ Python3 not found at $PYTHON_BIN"
    exit 1
fi

# Activate virtual environment if it exists
if [ -d "venv" ]; then
    source venv/bin/activate
fi

# Set Python path
export PYTHONPATH="$(pwd)"

echo "🚀 Starting FastAPI server on http://127.0.0.1:8000"
echo "📖 API docs available at http://127.0.0.1:8000/docs"
echo ""
echo "Press Ctrl+C to stop"
echo ""

# Use explicit Python path
"$PYTHON_BIN" -m uvicorn backend.app:app --host 127.0.0.1 --port 8000 --reload

