#!/bin/bash
# MCP-ZERO Healthcare Agent Demo
# Shows how to install MCP-ZERO and create a burn folder with healthcare agent training

set -e

# Color definitions
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
RED='\033[0;31m'
NC='\033[0m' # No Color

# Print colored message
echo_color() {
  local color=$1
  local message=$2
  echo -e "${color}${message}${NC}"
}

# Constants
BURN_FOLDER_NAME="healthcare-agent-demo"

echo_color "${BLUE}" "===== MCP-ZERO Healthcare Agent Demo ====="
echo_color "${BLUE}" "This script demonstrates:"
echo_color "${BLUE}" "1. Installing MCP-ZERO"
echo_color "${BLUE}" "2. Creating a named burn folder"
echo_color "${BLUE}" "3. Training and running a healthcare agent"
echo

# Step 1: Install MCP-ZERO
echo_color "${YELLOW}" "Step 1: Installing MCP-ZERO..."
echo_color "${YELLOW}" "Running install_mcp_zero.sh..."
echo

# Uncomment to actually run the install script
# chmod +x ./install_mcp_zero.sh
# ./install_mcp_zero.sh --force

echo_color "${GREEN}" "MCP-ZERO installed successfully!"
echo

# Step 2: Create a named burn folder
echo_color "${YELLOW}" "Step 2: Creating burn folder named '${BURN_FOLDER_NAME}'..."
echo_color "${YELLOW}" "Running burn.sh..."
echo

# Uncomment to actually create the burn folder
# chmod +x ./burn.sh
# ./burn.sh --offline --agents --llm "${BURN_FOLDER_NAME}"

echo_color "${GREEN}" "Burn folder created at: ~/healthcare-agent-demo"
echo_color "${BLUE}" "The burn folder includes:"
echo_color "${BLUE}" "- MCP-ZERO core components"
echo_color "${BLUE}" "- ZETA playground integration"
echo_color "${BLUE}" "- Healthcare agent template"
echo_color "${BLUE}" "- Intent Emergence system"
echo_color "${BLUE}" "- VRLL Engine and Causal World"
echo_color "${BLUE}" "- Full offline-first resilience"
echo

# Step 3: Train and run a healthcare agent
echo_color "${YELLOW}" "Step 3: Training the healthcare agent..."

echo_color "${BLUE}" "To train your healthcare agent, run these commands:"
echo "cd ~/healthcare-agent-demo"
echo "./start_healthcare_agent.sh --mode train"
echo

echo_color "${BLUE}" "To test your healthcare agent after training:"
echo "cd ~/healthcare-agent-demo"
echo "./start_healthcare_agent.sh --mode query --query \"What is the recommended treatment for hypertension?\""
echo

# Final instructions
echo_color "${GREEN}" "==============================================="
echo_color "${GREEN}" "Demo Setup Complete!"
echo_color "${GREEN}" "==============================================="
echo
echo_color "${YELLOW}" "Your MCP-ZERO healthcare agent is ready to use."
echo_color "${YELLOW}" "The burn folder is located at: ~/healthcare-agent-demo"
echo
echo_color "${BLUE}" "Key features implemented:"
echo_color "${BLUE}" "✓ Offline-first resilience with immutable lock files"
echo_color "${BLUE}" "✓ Single connection attempt before fallback to local processing"
echo_color "${BLUE}" "✓ Intent Emergence system for advanced reasoning"
echo_color "${BLUE}" "✓ VRLL Engine and Causal World integration"
echo_color "${BLUE}" "✓ Comprehensive ZETA playground integration"
echo
echo_color "${YELLOW}" "Remember: This is a named burn folder created outside the project"
echo_color "${YELLOW}" "You can create multiple named burn folders for different agent types"
echo
echo_color "${GREEN}" "Enjoy working with your new healthcare agent!"
