{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://banking.noetfield.com/schema/receipt-money-v1.json",
  "title": "ABCP receipt-money-v1",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "receipt_version",
    "run_id",
    "tenant_id",
    "agent_id",
    "outcome",
    "checks",
    "policy_version",
    "environment"
  ],
  "properties": {
    "receipt_version": {
      "const": "money-1"
    },
    "run_id": {
      "type": "string",
      "minLength": 1
    },
    "tenant_id": {
      "type": "string",
      "minLength": 1
    },
    "agent_id": {
      "type": "string",
      "minLength": 1
    },
    "outcome": {
      "type": "string",
      "enum": [
        "accepted",
        "rejected",
        "error",
        "pending"
      ]
    },
    "checks": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "passed"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "passed": {
            "type": "boolean"
          },
          "detail": {
            "type": "string"
          }
        }
      }
    },
    "policy_version": {
      "type": "string"
    },
    "environment": {
      "type": "string",
      "enum": [
        "ci",
        "sandbox",
        "pilot",
        "prod"
      ]
    },
    "amount_minor": {
      "type": "integer",
      "minimum": 0
    },
    "currency": {
      "type": "string",
      "minLength": 3,
      "maxLength": 3
    },
    "rail": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "partner": {
          "type": "string"
        },
        "partner_ref": {
          "type": "string"
        },
        "status": {
          "type": "string"
        }
      }
    },
    "tool": {
      "type": "string"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
