#!/usr/bin/env bash
# fake maas: only '<profile> subnets read' and '<profile> ipranges read' are emulated,
# each emitting the env-pointed fixture, and ONLY when the invoked profile == EXPECT_PROFILE
# (default admin) -- so a test can prove the verify passes MAAS_PROFILE through (DOCFIX-213).
# Anything else emits nothing. Never emulates 'maas list' (the real one prints the API key --
# DOCFIX-016; the verify must not call it).
EXPECT_PROFILE="${EXPECT_PROFILE:-admin}"
prof="${1:-}"; obj="${2:-}"; act="${3:-}"
if [ "$prof" = "$EXPECT_PROFILE" ] && [ "$obj" = "subnets" ] && [ "$act" = "read" ]; then
  cat "${FIX_SUBNETS:?FIX_SUBNETS not set}"
elif [ "$prof" = "$EXPECT_PROFILE" ] && [ "$obj" = "ipranges" ] && [ "$act" = "read" ]; then
  cat "${FIX_IPRANGES:?FIX_IPRANGES not set}"
fi
