{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nevlo-io/json-schema/nevlo-io-transaction-detail-schema.json",
  "title": "TransactionDetail",
  "description": "Full transaction details including counterpart info and technical codes",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/nevlo-io-api-openapi.json#/components/schemas/TransactionDetail",
  "allOf": [
    {
      "$ref": "#/$defs/Transaction"
    },
    {
      "type": "object",
      "properties": {
        "counterpartBic": {
          "type": [
            "string",
            "null"
          ]
        },
        "counterpartBankName": {
          "type": [
            "string",
            "null"
          ]
        },
        "counterpartCreditorId": {
          "type": [
            "string",
            "null"
          ],
          "description": "SEPA creditor identifier"
        },
        "counterpartDebitorId": {
          "type": [
            "string",
            "null"
          ]
        },
        "bankTransactionCode": {
          "type": [
            "string",
            "null"
          ],
          "description": "ISO 20022 bank transaction code (e.g. PMNT-RCDT-SALA)"
        },
        "sepaPurposeCode": {
          "type": [
            "string",
            "null"
          ],
          "description": "SEPA purpose code according to ISO 20022"
        },
        "isPotentialDuplicate": {
          "type": "boolean",
          "default": false
        },
        "isAdjustingEntry": {
          "type": "boolean",
          "default": false
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    }
  ],
  "$defs": {
    "BankAccountRef": {
      "type": "object",
      "required": [
        "id",
        "bankConnection"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "iban": {
          "type": [
            "string",
            "null"
          ]
        },
        "accountName": {
          "type": [
            "string",
            "null"
          ]
        },
        "bankConnection": {
          "type": "object",
          "required": [
            "bankName"
          ],
          "properties": {
            "bankName": {
              "type": "string"
            }
          }
        }
      }
    },
    "Transaction": {
      "type": "object",
      "required": [
        "id",
        "amount",
        "currency",
        "bookingDate",
        "bankAccount"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "amount": {
          "type": "number"
        },
        "currency": {
          "type": "string"
        },
        "bookingDate": {
          "type": "string",
          "format": "date-time"
        },
        "valueDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "merchantName": {
          "type": [
            "string",
            "null"
          ]
        },
        "counterpartName": {
          "type": [
            "string",
            "null"
          ]
        },
        "counterpartIban": {
          "type": [
            "string",
            "null"
          ]
        },
        "counterpartMandateReference": {
          "type": [
            "string",
            "null"
          ],
          "description": "SEPA direct debit mandate reference"
        },
        "type": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "direct_debit",
            "transfer",
            "standing_order",
            "cash_withdrawal",
            "cash_deposit",
            "card_payment",
            "interest",
            "fee",
            "salary",
            "other"
          ],
          "description": "Normalized transaction type"
        },
        "category": {
          "type": [
            "string",
            "null"
          ]
        },
        "purpose": {
          "type": [
            "string",
            "null"
          ]
        },
        "bankAccount": {
          "$ref": "#/$defs/BankAccountRef"
        }
      }
    }
  }
}