#!/bin/bash
cd "$(dirname "$0")/.."

PASS=0
FAIL=0
TOTAL=0

echo "=== Dev Intel v2 — Ground Truth Benchmark Suite ==="
echo ""

for gt in test/ground-truth/*.json; do
  name=$(basename "$gt" .json)
  TOTAL=$((TOTAL + 1))
  result=$(node validate-ground-truth.js "$gt" 2>&1)
  if echo "$result" | grep -q "^PASS"; then
    echo "✅ PASS  $name"
    PASS=$((PASS + 1))
  else
    echo "❌ FAIL  $name"
    echo "$result" | grep -E "^(Entities|Relationships|Missing)" | sed 's/^/         /'
    FAIL=$((FAIL + 1))
  fi
done

echo ""
echo "=== Results: $PASS/$TOTAL passed, $FAIL failed ==="

if [ $FAIL -gt 0 ]; then
  exit 1
fi
