#!/usr/bin/env bash
# Three-case probe from the Rabbit Hole Generator, plus an optional bearer key.
set -u
BASE="$1"
KEY="${2:-}"
probe() {
  name="$1"
  body="$2"
  printf '\n=== %s ===\nRequest: %s\nResponse:\n' "$name" "$body"
  curl -sS -w '\nHTTP %{http_code}\n' \
    -H 'Content-Type: application/json' \
    ${KEY:+-H "Authorization: Bearer $KEY"} \
    -X POST "$BASE/v1/agent/authorize" \
    --data "$body"
}
probe destructive '{"agent_id":"lab-agent","action":"delete_all_records","resource":"customer_database","context":{"confidence":0.99}}'
probe low_confidence '{"agent_id":"lab-agent","action":"send_customer_email","resource":"customer:42","context":{"confidence":0.31}}'
probe routine_read '{"agent_id":"lab-agent","action":"read_record","resource":"customer:42","context":{"confidence":0.99}}'
