#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"

if [ -z "$1" ]; then
  echo "Usage: ./run-module.sh <module>"
  echo ""
  echo "Available modules:"
  echo "  auth    - 身份与权限域"
  echo "  space   - 空间与项目域"
  echo "  asset   - 设备与资产域"
  echo "  ops     - 运营与服务域"
  echo "  finance - 财务与收费域"
  exit 1
fi

MODULE="$1"
SCRIPT="$SCRIPT_DIR/$MODULE/test-$MODULE.sh"

if [ ! -f "$SCRIPT" ]; then
  echo "ERROR: Test script not found: $SCRIPT"
  exit 1
fi

echo ">>> Running $MODULE API tests..."
echo "----------------------------------------"
bash "$SCRIPT"
exit $?
