#!/usr/bin/env bash
# fake maas for re-CIDR: serves reads from fixtures; mutations succeed (apply path).
prof="${1:-}"; obj="${2:-}"; act="${3:-}"; a4="${4:-}"
case "$obj $act" in
"subnets read") cat "${FIX_SUBNETS:?}"; exit 0 ;;
"ipranges read") cat "${FIX_IPRANGES:?}"; exit 0 ;;
"subnet ip-addresses") cat "${FIX_IPADDRS:?}"; exit 0 ;;
"vlans read") jq --arg f "$a4" '[.[]|select((.fabric_id|tostring)==$f)]' "${FIX_VLANS:?}"; exit 0 ;;
"subnets create"|"subnet delete"|"iprange delete") echo "Success."; exit 0 ;;
esac
echo "{}"; exit 0