#!/bin/bash
# Update all game banner dashboards
# This script fetches current banner data via web search API

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
API_KEY="${CHAT_SEARCH_API_KEY:-ocs_jjSV4579mEMNiXZx86awBDDuxOrbUDEmB9Ytbt5S2MEZvui5}"

echo "🎮 Fetching current banner data..."
echo "=================================="
echo ""

# Fetch Genshin Impact banners
echo "📊 Genshin Impact..."
GENSHIN_DATA=$(curl -s -X POST https://pwafbamvoajoiepdmzlz.supabase.co/functions/v1/chat-search \
  -H "Content-Type: application/json" \
  -H "x-api-key: $API_KEY" \
  -d '{"message": "What are the current Genshin Impact character and weapon banners as of April 2026? List the 5-star and 4-star characters.", "sessionId": null, "createSessionIfMissing": true}')

echo "$GENSHIN_DATA" | jq -r '.answer'
echo ""

# Fetch Wuthering Waves banners
echo "📊 Wuthering Waves..."
WW_DATA=$(curl -s -X POST https://pwafbamvoajoiepdmzlz.supabase.co/functions/v1/chat-search \
  -H "Content-Type: application/json" \
  -H "x-api-key: $API_KEY" \
  -d '{"message": "What are the current Wuthering Waves character banners as of April 2026? List all characters and their elements.", "sessionId": null, "createSessionIfMissing": true}')

echo "$WW_DATA" | jq -r '.answer'
echo ""

echo "✅ Data fetched! Update the JSON files manually or use the interactive updater."
