{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/traiana/refs/heads/main/json-schema/settlement.json",
  "title": "Settlement",
  "description": "A settlement instruction generated from Traiana NetLink netting sessions, representing PvP settlement orchestration for FX and other asset classes.",
  "type": "object",
  "properties": {
    "settlementId": {
      "type": "string",
      "description": "Unique identifier for the settlement instruction"
    },
    "nettingSessionId": {
      "type": "string",
      "description": "Identifier of the originating netting session"
    },
    "counterpartyId": {
      "type": "string",
      "description": "Identifier of the counterparty"
    },
    "currencyPair": {
      "type": "string",
      "description": "Currency pair being settled"
    },
    "payAmount": {
      "type": "number",
      "description": "Amount to be paid"
    },
    "payCurrency": {
      "type": "string",
      "description": "ISO 4217 currency code for the pay leg"
    },
    "receiveAmount": {
      "type": "number",
      "description": "Amount to be received"
    },
    "receiveCurrency": {
      "type": "string",
      "description": "ISO 4217 currency code for the receive leg"
    },
    "settlementDate": {
      "type": "string",
      "format": "date",
      "description": "Settlement value date"
    },
    "status": {
      "type": "string",
      "description": "Current settlement status",
      "enum": ["Pending", "Instructed", "Settled", "Failed"]
    },
    "settledAt": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp when settlement was completed"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp when the instruction was created"
    }
  },
  "required": ["settlementId", "counterpartyId", "currencyPair", "payAmount", "payCurrency", "receiveAmount", "receiveCurrency", "settlementDate", "status"]
}