{
  "$schema": "http://json-schema.org/draft-07/schema",
  "$id": "payment.schema.json",
  "title": "payment",
  "type": "object",
  "properties": {
    "type": {
      "$ref": "enum/payment_type.schema.json#/$defs/payment_type",
      "description": "Zahlweise (Lastschrift/Rechnung)"
    }
  },

  "required": ["type"],

  "allOf": [
    {
      "if": {"properties": {"type": {"const": "debit"}}},
      "then": {
        "properties": {"bank_data": {"$ref": "bank_data.schema.json"}},
        "required": ["bank_data"]
      }
    }
  ]
}