#!/bin/bash
# Quick Development Start Script

set -e

echo "🚀 Starting Infoscreen Development Environment..."

# Check if Docker is running
if ! docker info > /dev/null 2>&1; then
    echo "❌ Docker is not running. Please start Docker first."
    exit 1
fi

# Check if .env exists
if [ ! -f .env ]; then
    echo "❌ .env file not found. Please run setup-dev-environment.sh first."
    exit 1
fi

# Start development stack
echo "📦 Starting development containers..."
docker compose up -d --build

# Wait for services to be ready
echo "⏳ Waiting for services to start..."
sleep 10

# Show status
echo "📊 Container Status:"
docker compose ps

echo ""
echo "🌐 Services Available:"
echo "  Dashboard (Vite):     http://localhost:5173"
echo "  API (Flask):          http://localhost:8000"
echo "  API Health Check:     http://localhost:8000/health"
echo "  Database (MariaDB):   localhost:3306"
echo "  MQTT Broker:          localhost:1883"
echo "  MQTT WebSocket:       localhost:9001"
echo "  Python Debugger:      localhost:5678"
echo ""
echo "📝 Useful Commands:"
echo "  View logs:            docker compose logs -f"
echo "  Stop services:        docker compose down"
echo "  Restart service:      docker compose restart [service-name]"
echo ""
echo "🎉 Development environment is ready!"
