#!/bin/bash

# test.sh - Test the API endpoints

echo "🧪 Testing PHP MCP SQL Agent..."
echo ""

# Test 1: Health Check
echo "1️⃣  Testing Health Endpoint..."
curl -s http://localhost:3000/health | jq .
echo ""

# Test 2: Chat Endpoint - Schema Request
echo "2️⃣  Testing Chat Endpoint (Schema Request)..."
curl -s -X POST http://localhost:3000/chat \
  -H "Content-Type: application/json" \
  -d '{"message": "What tables are in the database?"}' | jq .
echo ""

# Test 3: Chat Endpoint - SQL Query
echo "3️⃣  Testing Chat Endpoint (SQL Query)..."
curl -s -X POST http://localhost:3000/chat \
  -H "Content-Type: application/json" \
  -d '{"message": "Show me all records from the users table"}' | jq .
echo ""

# Test 4: MCP Server - List Tools
echo "4️⃣  Testing MCP Server (List Tools)..."
curl -s http://localhost:8085/tools | jq .
echo ""

echo "✅ All tests completed!"
