#!/usr/bin/env bash
# ai_node/ask_accounting.sh — forward a ratio/depreciation/covenant query to the
# native Premium Accounting Angel decision binary. Pure pass-through: this script
# computes nothing; every field in the JSON reply comes from the binary.
#   usage: ask_accounting.sh <tool> field=value [field=value ...]
#   example: ask_accounting.sh current_ratio current_assets=3000 current_liabilities=2000
set -euo pipefail
HERE="$(cd "$(dirname "$0")" && pwd)"
BIN="$HERE/../bin/apostol-22-premium-accounting-decide"
[ -x "$BIN" ] || { echo "missing binary: $BIN" >&2; exit 4; }
if [ "$#" -lt 1 ]; then
  echo "usage: $0 <tool> field=value [field=value ...]" >&2
  echo "example: $0 current_ratio current_assets=3000 current_liabilities=2000" >&2
  echo "tools: straight_line_annual double_declining_annual units_of_production_annual" >&2
  echo "       accumulated_depreciation net_book_value impairment_flag current_ratio" >&2
  echo "       quick_ratio debt_to_equity covenant_test method_consistency classification_current" >&2
  exit 2
fi
exec "$BIN" "$@"
