{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://fdc3.finos.org/schemas/next/context/payment.schema.json",
  "type": "object",
  "title": "Payment",
  "description": "@experimental context type representing an institutional payment instruction, mapping to ISO 20022 pacs.008 (FIToFICustomerCreditTransfer). This type defines routing and settlement details including amount, currency, debtor, creditor, and optional network routing information.",
  "allOf": [
    {
      "type": "object",
      "properties": {
        "type": {
          "const": "fdc3.payment"
        },
        "id": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "title": "Payment Identifiers",
          "description": "One or more identifiers that refer to the payment in an OMS, EMS, or Settlement network (e.g., UETR, TransactionHash)."
        },
        "name": {
          "type": "string",
          "title": "Name",
          "description": "An optional human-readable summary of the payment context."
        },
        "amount": {
          "type": "number",
          "title": "Amount",
          "description": "The exact numerical value of the payment."
        },
        "currency": {
          "type": "string",
          "title": "Currency",
          "description": "The ISO 4217 currency code or standard asset identifier (e.g., 'USD', 'EUR', 'GBP')."
        },
        "debtor": {
          "type": "object",
          "title": "Debtor Information",
          "description": "The originating party initiating the payment.",
          "properties": {
            "name": { "type": "string" },
            "account": { "type": "string" },
            "agent": { "type": "string" }
          },
          "required": ["account"]
        },
        "creditor": {
          "type": "object",
          "title": "Creditor Information",
          "description": "The receiving party for the payment.",
          "properties": {
            "name": { "type": "string" },
            "account": { "type": "string" },
            "agent": { "type": "string" }
          },
          "required": ["account"]
        },
        "networkRouting": {
          "type": "object",
          "title": "Network Routing Details",
          "description": "Optional parameters for payment routing and settlement execution, such as clearing system identifiers, rail routing codes, or network-specific execution parameters.",
          "additionalProperties": { "type": "string" }
        }
      },
      "required": [
        "type",
        "id",
        "amount",
        "currency",
        "debtor",
        "creditor"
      ],
      "additionalProperties": true
    },
    { "$ref": "context.schema.json#/definitions/BaseContext" }
  ],
  "examples": [
    {
      "type": "fdc3.payment",
      "name": "ISO 20022 pacs.008 Settlement",
      "id": {
        "UETR": "123e4567-e89b-12d3-a456-426614174000"
      },
      "amount": 150000.00,
      "currency": "USD",
      "debtor": {
        "name": "Acme Corp",
        "account": "GB33BUKB20201555555555"
      },
      "creditor": {
        "name": "Global Treasury Ltd",
        "account": "US33CHAS021000021"
      },
      "networkRouting": {
        "rail": "RTGS",
        "settlementMethod": "CLRG",
        "clearingSystem": "SWIFT"
      }
    }
  ]
}
