#!/bin/bash

# Test Momentry Core API directly
# This bypasses n8n and tests the API directly

echo "=========================================="
echo "Testing Momentry Core API Directly"
echo "=========================================="
echo ""

# Test 1: Health check
echo "Test 1: Health Check"
curl -s http://localhost:3002/api/v1/health 2>&1 | head -5
echo ""

# Test 2: Search API
echo "Test 2: Search API"
echo "Query: 'charade'"
curl -s -X POST http://localhost:3002/api/v1/n8n/search \
  -H "Content-Type: application/json" \
  -d '{"query":"charade","limit":3}' | python3 -m json.tool
echo ""

# Test 3: List videos
echo "Test 3: List Videos"
curl -s http://localhost:3002/api/v1/videos | python3 -m json.tool 2>/dev/null || echo "No videos or endpoint error"
echo ""

echo "=========================================="
echo "If all tests show JSON responses, API is working!"
echo ""
echo "Next step: Use the API in n8n workflows"
echo "=========================================="
