{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/valinvo-bmk-hub-com/json-schema/valinvo-bmk-hub-com-generated-invoice-response-schema.json",
  "title": "GeneratedInvoiceResponse",
  "x-generated": "2026-12-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/valinvo-bmk-hub-com-openapi.json#/components/schemas/GeneratedInvoiceResponse",
  "type": "object",
  "required": [
    "format",
    "contentType",
    "encoding",
    "document",
    "validation"
  ],
  "properties": {
    "format": {
      "type": "string"
    },
    "contentType": {
      "type": "string"
    },
    "encoding": {
      "type": "string",
      "enum": [
        "utf-8",
        "base64"
      ],
      "description": "`utf-8` for XML text, `base64` for binary documents such as PDF."
    },
    "document": {
      "type": "string",
      "description": "The e-invoice."
    },
    "validation": {
      "$ref": "#/$defs/ValidationReport"
    }
  },
  "$defs": {
    "ValidationIssue": {
      "type": "object",
      "required": [
        "message"
      ],
      "properties": {
        "rule": {
          "type": "string",
          "description": "Official rule ID, e.g. `BR-DE-15`; absent for XML schema errors."
        },
        "message": {
          "type": "string",
          "description": "The rule's message as published with the official rules."
        },
        "location": {
          "type": "string",
          "description": "XPath of the offending element for rule errors; XML schema errors carry only the document name."
        },
        "line": {
          "type": "integer",
          "description": "Line in the XML (for a PDF: in the embedded XML), where the element's start tag ends. Absent when unknown, and for checks of the PDF itself."
        },
        "column": {
          "type": "integer",
          "description": "Column in the XML, with `line`."
        },
        "explanation": {
          "type": "string",
          "description": "Our own English for rules whose official `message` exists only in German (XRechnung's `BR-DE-…`). Not an official text."
        }
      }
    },
    "ValidationReport": {
      "type": "object",
      "required": [
        "ruleSet",
        "valid",
        "errors",
        "warnings"
      ],
      "properties": {
        "ruleSet": {
          "type": "string",
          "description": "The rules applied, e.g. `xrechnung-3.0.2-ubl-invoice`."
        },
        "valid": {
          "type": "boolean",
          "description": "True when there are no errors; warnings don't make an invoice invalid."
        },
        "errors": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ValidationIssue"
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ValidationIssue"
          }
        }
      }
    }
  }
}