{
  "decision": {
    "name": "Example \u00b7 Expense claims",
    "inputs": {
      "amount": {
        "type": "number > 0",
        "desc": "Total expense amount in USD",
        "from": "claim JSON"
      },
      "people": {
        "type": "number >= 1",
        "desc": "Number of people, including the employee",
        "from": "claim JSON"
      },
      "receipt_attached": {
        "type": "boolean",
        "desc": "Is a receipt attached?",
        "from": "claim JSON"
      },
      "expense_date": {
        "type": "date",
        "desc": "Date the expense was incurred",
        "from": "claim JSON"
      },
      "submitted_on": {
        "type": "date",
        "desc": "Submission date",
        "from": "claim JSON"
      }
    },
    "decisions": {
      "per_person_cap": {
        "type": "number",
        "desc": "Per-person meal cap in USD, policy \u00a72.1",
        "expr": "75"
      },
      "receipt_threshold": {
        "type": "number",
        "desc": "Receipt required above this total in USD, policy \u00a72.2",
        "expr": "75"
      },
      "submission_window_days": {
        "type": "number",
        "desc": "Submission window in days, policy \u00a72.3",
        "expr": "30"
      },
      "manager_threshold": {
        "type": "number",
        "desc": "Manager review above this total in USD, policy \u00a72.4",
        "expr": "500"
      },
      "cost_per_person": {
        "type": "number",
        "desc": "Expense per person in USD",
        "expr": "amount / people"
      },
      "elapsed_days": {
        "type": "number",
        "desc": "Days between expense and submission",
        "expr": "(submitted_on - expense_date).days"
      },
      "within_cap": {
        "type": "boolean",
        "desc": "Is the expense within the per-person cap?",
        "expr": "cost_per_person <= per_person_cap"
      },
      "receipt_required": {
        "type": "boolean",
        "desc": "Does the amount require a receipt?",
        "expr": "amount > receipt_threshold"
      },
      "late": {
        "type": "boolean",
        "desc": "Is the claim outside the submission window?",
        "expr": "elapsed_days > submission_window_days"
      },
      "disposition": {
        "type": "auto_approve|manager|reject",
        "desc": "Should this expense be auto-approved, sent to a manager or rejected?",
        "table": [
          [
            "elapsed_days",
            "within_cap",
            "receipt_required",
            "receipt_attached",
            "late",
            "amount > manager_threshold",
            "=> auto_approve|manager|reject",
            "# why"
          ],
          {
            "when": {
              "elapsed_days": "< 0"
            },
            "then": "reject",
            "why": "Expense date is after the submission date; check the dates."
          },
          {
            "when": {
              "within_cap": "false"
            },
            "then": "reject",
            "why": "Per-person amount exceeds the cap, policy \u00a72.1."
          },
          {
            "when": {
              "receipt_required": "true",
              "receipt_attached": "false"
            },
            "then": "reject",
            "why": "Receipt required above the threshold, policy \u00a72.2."
          },
          {
            "when": {
              "late": "true"
            },
            "then": "manager",
            "why": "Within the per-person cap, but submitted outside the allowed window, policy \u00a72.3."
          },
          {
            "when": {
              "amount > manager_threshold": "true"
            },
            "then": "manager",
            "why": "Amount exceeds the manager-review threshold, policy \u00a72.4."
          },
          {
            "then": "auto_approve",
            "why": "Within the cap, receipt requirement and submission window, policy \u00a7\u00a72.1\u20132.4."
          }
        ]
      }
    }
  },
  "state": {
    "amount": 184,
    "people": 3,
    "receipt_attached": true,
    "expense_date": "2026-03-02",
    "submitted_on": "2026-04-12"
  }
}
