#!/bin/bash
# Identity Agent Test Script
# Usage: ./scripts/test_identity_agent.sh [video_uuid]

set -e

API_URL="${API_URL:-http://localhost:3003}"
API_KEY="${API_KEY:-muser_68600856036340bcafc01930eb4bd839_1774418104_97221b69}"
UUID="${1:-384b0ff44aaaa1f1}"

echo "=== Identity Agent Test ==="
echo "API URL: $API_URL"
echo "Video UUID: $UUID"
echo ""

echo "=== Test 1: Get Identity Agent Status ==="
curl -s "$API_URL/api/v1/agents/identity/status" \
  -H "X-API-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  | python3 -m json.tool

echo ""
echo "=== Test 2: Analyze Identity ==="
curl -s -X POST "$API_URL/api/v1/agents/identity/analyze" \
  -H "X-API-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"video_uuid\":\"$UUID\"}" \
  | python3 -m json.tool

echo ""
echo "=== Test 3: Suggest Merges ==="
curl -s -X POST "$API_URL/api/v1/agents/identity/suggest" \
  -H "X-API-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"video_uuid\":\"$UUID\"}" \
  | python3 -m json.tool

echo ""
echo "=== Test 4: Python Identity Agent CLI ==="
python3 scripts/identity_agent.py --video-uuid "$UUID" --analyze

echo ""
echo "=== Test Complete ==="