#!/bin/zsh
# Throwaway probe: test a RapidAPI key against the Estate Real-Time UAE host.
#   zsh uae-probe.sh YOUR_RAPIDAPI_KEY
# No key argument = uses ESTATE_UAE_RAPIDAPI_KEY from .env (the peta-new key).
KEY="${1:-$(grep '^ESTATE_UAE_RAPIDAPI_KEY=' .env | cut -d= -f2-)}"

if [ -z "$KEY" ]; then
    echo "usage: zsh uae-probe.sh YOUR_RAPIDAPI_KEY" >&2
    exit 1
fi

echo "Probing estate-real-time-uae.p.rapidapi.com with key ending …${KEY: -4}"
curl -s --max-time 20 \
    -w "\nhttp=%{http_code} total=%{time_total}s\n" \
    "https://estate-real-time-uae.p.rapidapi.com/new-projects/auto-complete?query=Marina" \
    -H "x-rapidapi-host: estate-real-time-uae.p.rapidapi.com" \
    -H "x-rapidapi-key: $KEY" | head -6
