{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/sipi/main/json-schema/sipi-transaction-schema.json",
  "title": "Transaction",
  "x-generated": "2026-10-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sipi-openapi.json#/components/schemas/Transaction",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "amount": {
      "type": "number"
    },
    "merchant": {
      "type": "string"
    },
    "category": {
      "type": "string"
    },
    "decision": {
      "$ref": "#/$defs/Decision"
    },
    "reason": {
      "type": "string"
    },
    "agent_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "timestamp": {
      "type": "string",
      "format": "date-time"
    }
  },
  "$defs": {
    "Decision": {
      "type": "string",
      "enum": [
        "APPROVED",
        "BLOCKED",
        "FLAGGED"
      ],
      "description": "APPROVED = pass all rules. BLOCKED = violates a hard rule, no money moves. FLAGGED = allowed but crosses an approval threshold, routed to the human queue."
    }
  }
}