#!/bin/bash
# Test script for Crumbforest Chat API
# Tests both Krümeleule and FunkFox characters

API_URL="http://localhost:8000/api/chat"

echo "🌲🦊🦉 Crumbforest Chat API Test Suite"
echo "============================================================"

# Test 1: Krümeleule
echo ""
echo "============================================================"
echo "🧪 Testing: KRÜMELEULE"
echo "📝 Question: Was ist ADHS als Kraftquelle?"
echo "============================================================"
echo ""

curl -X POST "$API_URL" \
  -H "Content-Type: application/json" \
  -d '{
    "character_id": "eule",
    "question": "Was ist ADHS als Kraftquelle?",
    "lang": "de"
  }' \
  -w "\n\n✅ Status Code: %{http_code}\n" \
  -s | jq -r '
    if .answer then
      "💬 Answer:\n\(.answer)\n\n📚 Sources: \(.sources | length)\n🤖 Provider: \(.provider)\n🧠 Model: \(.model)"
    else
      "❌ Error: " + (. | tostring)
    end
  '

echo ""
echo ""

# Test 2: FunkFox
echo "============================================================"
echo "🧪 Testing: FUNKFOX"
echo "📝 Question: Was ist ein Terminal und wie nutzt man es?"
echo "============================================================"
echo ""

curl -X POST "$API_URL" \
  -H "Content-Type: application/json" \
  -d '{
    "character_id": "fox",
    "question": "Was ist ein Terminal und wie nutzt man es?",
    "lang": "de"
  }' \
  -w "\n\n✅ Status Code: %{http_code}\n" \
  -s | jq -r '
    if .answer then
      "💬 Answer:\n\(.answer)\n\n📚 Sources: \(.sources | length)\n🤖 Provider: \(.provider)\n🧠 Model: \(.model)"
    else
      "❌ Error: " + (. | tostring)
    end
  '

echo ""
echo "============================================================"
echo "🎉 Tests complete! BOOOYAAAA! 🚀"
echo "============================================================"
