#!/usr/bin/env bash
# Run all VMID 5000 deployment checks: explorer frontend, Blockscout API, Snap site,
# Visual Command Center, and Mission Control endpoints.
# Usage: ./verify-vmid5000-all.sh [BASE_URL]
#   BASE_URL defaults to https://explorer.d-bis.org

set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BASE_URL="${1:-https://explorer.d-bis.org}"

echo "=============================================="
echo "VMID 5000 – full explorer verification"
echo "BASE_URL=$BASE_URL"
echo "=============================================="
echo ""

bash "$SCRIPT_DIR/verify-explorer-api-access.sh" "$BASE_URL"

if [[ -n "${ACCESS_INTERNAL_SECRET:-}" ]]; then
  echo ""
  echo "Running access edge-hook verification with ACCESS_INTERNAL_SECRET..."
  bash "$SCRIPT_DIR/verify-explorer-access-edge-hook.sh" \
    --base-url "$BASE_URL" \
    --internal-secret "$ACCESS_INTERNAL_SECRET"
else
  echo ""
  echo "Skipping access edge-hook verification because ACCESS_INTERNAL_SECRET is not set."
fi
