#!/bin/bash

# Setup Docker Networks for AI Tax Agent (production/dev stacks)
# Creates apa-frontend and apa-backend networks if they don't exist

set -e

# Colors
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'

log_info() {
    echo -e "${BLUE}ℹ️  $1${NC}"
}

log_success() {
    echo -e "${GREEN}✅ $1${NC}"
}

log_warning() {
    echo -e "${YELLOW}⚠️  $1${NC}"
}

log_info "Setting up Docker networks..."

# Create frontend network
if docker network inspect apa-frontend >/dev/null 2>&1; then
    log_warning "Network 'apa-frontend' already exists"
else
    docker network create apa-frontend
    log_success "Created network 'apa-frontend'"
fi

# Create backend network
if docker network inspect apa-backend >/dev/null 2>&1; then
    log_warning "Network 'apa-backend' already exists"
else
    docker network create apa-backend
    log_success "Created network 'apa-backend'"
fi

log_success "Docker networks ready!"
echo ""
log_info "Networks:"
docker network ls | grep -E "apa-frontend|apa-backend"
