#!/bin/bash

# Setup script for Unified Tech Stack Service
# This script helps configure the environment for the service

echo "🚀 Setting up Unified Tech Stack Service Environment"
echo "=================================================="

# Check if .env file exists
if [ ! -f .env ]; then
    echo "📝 Creating .env file from template..."
    cp env.example .env
    echo "✅ .env file created"
else
    echo "📝 .env file already exists"
fi

echo ""
echo "🔧 Environment Configuration Required:"
echo "======================================"
echo ""
echo "1. Claude AI API Key:"
echo "   - Get your API key from: https://console.anthropic.com/"
echo "   - Add it to .env file as: CLAUDE_API_KEY=your_key_here"
echo ""
echo "2. Service URLs (if different from defaults):"
echo "   - TEMPLATE_MANAGER_URL=http://localhost:8009"
echo "   - TECH_STACK_SELECTOR_URL=http://localhost:8002"
echo ""
echo "3. Optional Configuration:"
echo "   - PORT=8013 (default)"
echo "   - REQUEST_TIMEOUT=30000"
echo "   - CACHE_TTL=300000"
echo ""

# Check if Claude API key is configured
if grep -q "CLAUDE_API_KEY=your_claude_api_key_here" .env; then
    echo "⚠️  WARNING: Claude API key not configured!"
    echo "   Please edit .env file and set your CLAUDE_API_KEY"
    echo "   Without this key, Claude AI recommendations will not work"
    echo ""
else
    echo "✅ Claude API key appears to be configured"
fi

echo "📋 Next Steps:"
echo "=============="
echo "1. Edit .env file with your actual API keys"
echo "2. Install dependencies: npm install"
echo "3. Start the service: npm start"
echo "4. Test the service: node test-comprehensive-integration.js"
echo ""
echo "🔗 Service will be available at: http://localhost:8013"
echo "📊 Health check: http://localhost:8013/health"
echo "🤖 Comprehensive recommendations: http://localhost:8013/api/unified/comprehensive-recommendations"
echo ""
echo "🏁 Setup complete!"
