#!/bin/bash
echo "=== REAL PRODUCT SLUGS ==="
echo "SELECT slug FROM products WHERE image_url IS NOT NULL LIMIT 3;" | docker exec -i supabase-db psql -U postgres -d sneakerpicks -t

SLUG=$(echo "SELECT p.slug FROM products p JOIN product_offers po ON po.product_id = p.id AND po.in_stock = true WHERE p.image_url IS NOT NULL GROUP BY p.slug HAVING COUNT(po.id) > 2 LIMIT 1;" | docker exec -i supabase-db psql -U postgres -d sneakerpicks -t | tr -d ' ')
echo "Testing real product: $SLUG"
curl -s "http://localhost:3001/sneakers/$SLUG" | grep -c 'shops op voorraad'
echo " shops-op-voorraad mentions"
curl -s "http://localhost:3001/sneakers/$SLUG" | grep -c 'Beschikbare maten'
echo " beschikbare-maten mentions"
curl -s "http://localhost:3001/sneakers/$SLUG" | grep -c 'brand-logo'
echo " brand-logo mentions"
curl -s "http://localhost:3001/sneakers/$SLUG" | grep -oP 'vanaf €[0-9,.]+'  | head -3
echo "=== PRODUCT COUNT STAT ==="
echo "SELECT COUNT(DISTINCT p.id) FROM products p JOIN product_offers po ON po.product_id = p.id AND po.in_stock = true WHERE p.image_url IS NOT NULL AND p.image_url != '';" | docker exec -i supabase-db psql -U postgres -d sneakerpicks -t
