#!/bin/bash
echo "=== CHECK IF MOCK SLUGS ARE IN DB ==="
echo "SELECT slug FROM products WHERE slug IN ('nike-air-max-1-86-og-big-bubble', 'adidas-samba-og-white-green', 'nike-dunk-low-panda');" | docker exec -i supabase-db psql -U postgres -d sneakerpicks

echo "=== CHECK IN_STOCK OFFERS ==="
echo "SELECT COUNT(*) FROM product_offers WHERE in_stock = true;" | docker exec -i supabase-db psql -U postgres -d sneakerpicks -t

echo "=== CHECK PRODUCTS WITH IN_STOCK OFFERS AND IMAGES ==="
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

echo "=== SAMPLE products joined ==="
echo "SELECT p.slug, MIN(po.price) as price 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 ORDER BY COUNT(po.id) DESC LIMIT 5;" | docker exec -i supabase-db psql -U postgres -d sneakerpicks
