{
  "$defs": {
    "Address": {
      "properties": {
        "city": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-37, BT-52",
          "title": "City"
        },
        "country": {
          "anyOf": [
            {
              "examples": [
                "DE"
              ],
              "pattern": "^[A-Z]{2}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-40, BT-55: ISO 3166-1 alpha-2",
          "title": "Country"
        },
        "postal_code": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-38, BT-53",
          "title": "Postal Code"
        },
        "street": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-35 (seller), BT-50 (buyer)",
          "title": "Street"
        }
      },
      "title": "Address",
      "type": "object"
    },
    "Attention": {
      "description": "What a person should look at before booking it.\n\n- `sums`: A check with `sums: true` failed\n- `outgoing`: The business issued it\n- `possible_duplicate`: An earlier document has its kind, number and seller (`possible_duplicate_of`)\n- `self_billed`: A self-billed invoice (Gutschrift): the buyer issued it",
      "enum": [
        "sums",
        "outgoing",
        "possible_duplicate",
        "self_billed"
      ],
      "title": "Attention",
      "type": "string"
    },
    "Card": {
      "description": "What a document without fields of its own says: a title, a summary\nand its facts (deadlines first).",
      "properties": {
        "facts": {
          "items": {
            "$ref": "#/$defs/Fact"
          },
          "title": "Facts",
          "type": "array"
        },
        "summary": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Summary"
        },
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Title"
        }
      },
      "required": [
        "facts"
      ],
      "title": "Card",
      "type": "object"
    },
    "Check": {
      "description": "A check Ocost ran in code, and whether it passed.",
      "properties": {
        "at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The rate or the line it is about",
          "title": "At"
        },
        "fields": {
          "description": "The paths it is about, as `sources` names them",
          "items": {
            "examples": [
              "totals.gross"
            ],
            "pattern": "^[a-z_]+(\\[[0-9]+\\])?(\\.[a-z_]+)*$",
            "type": "string"
          },
          "title": "Fields",
          "type": "array"
        },
        "name": {
          "$ref": "#/$defs/CheckName",
          "description": "What it checked; `sums` says whether it is one of the sums"
        },
        "passed": {
          "title": "Passed",
          "type": "boolean"
        },
        "sums": {
          "description": "One of the sums (total, vat, vat_net, vat_tax, gross, payable, signs, skonto, deduction, deductions, quantity): fill a bill only when all pass",
          "title": "Sums",
          "type": "boolean"
        }
      },
      "required": [
        "name",
        "passed",
        "sums",
        "fields"
      ],
      "title": "Check",
      "type": "object"
    },
    "CheckName": {
      "description": "A check Ocost ran in code on what it read.\n\n- `total`: A total was read\n- `vat`: A VAT group's VAT is its net × rate (`at` the rate)\n- `vat_net`: The VAT groups' nets add up to the net\n- `vat_tax`: The VAT groups' VAT adds up to the VAT\n- `gross`: Net plus VAT is the gross (the net, with no VAT printed)\n- `payable`: What is left to pay is between nothing and the gross\n- `signs`: No total is negative\n- `deduction`: A deducted invoice's net plus VAT is its gross (`at` which)\n- `deductions`: The gross less the deductions is what is left to pay\n- `quantity`: A delivered quantity is positive, or the line is backordered (`at` the line)\n- `skonto`: A Skonto is plausible: up to 10 %, within a year\n- `line`: A line's quantity × price, less its discount, is its net (`at` the line)\n- `lines_net`: The lines add up to the net (the gross, priced with VAT)\n- `lines_currency`: The lines are in another currency than the totals (`at` it)\n- `vat_lines`: A VAT group's net is its lines' (`at` the rate)\n- `iban`: The IBAN's check digits hold\n- `vat_id`: A German VAT ID's check digit holds\n- `issued_on`: The issue date is neither years ago nor ahead\n- `due_on`: The due date isn't before the issue date\n- `service`: The service period starts before it ends\n- `valid_until`: A quote holds until after its issue date\n- `delivery_on`: The delivery date is near the issue date\n- `stated`: The amounts stated in a second currency add up\n- `stated_rate`: The amounts in both currencies agree at the rate printed, else the ECB's (`at` the rate)\n- `payment_sum`: A contract's payment: net plus VAT is its gross (`at` which)\n- `payment_vat`: A contract's payment: its VAT is its net × rate\n- `payment_sign`: A contract's payment: its amounts are positive\n- `step`: A stepped rent's step falls in the term, in order\n- `first_payment`: A contract's first payment falls in its term\n- `deposit`: A contract's deposit is positive",
      "enum": [
        "total",
        "vat",
        "vat_net",
        "vat_tax",
        "gross",
        "payable",
        "signs",
        "deduction",
        "deductions",
        "quantity",
        "skonto",
        "line",
        "lines_net",
        "lines_currency",
        "vat_lines",
        "iban",
        "vat_id",
        "issued_on",
        "due_on",
        "service",
        "valid_until",
        "delivery_on",
        "stated",
        "stated_rate",
        "payment_sum",
        "payment_vat",
        "payment_sign",
        "step",
        "first_payment",
        "deposit"
      ],
      "title": "CheckName",
      "type": "string"
    },
    "Confidence": {
      "description": "How sure Ocost is of a value, from its checks: never a model's grade.\n\n- `checked`: A check confirmed it, or it came from an e-invoice\n- `read`: Nothing speaks against it\n- `doubt`: A check failed (`why` names it), or its words weren't on its page",
      "enum": [
        "checked",
        "read",
        "doubt"
      ],
      "title": "Confidence",
      "type": "string"
    },
    "Contact": {
      "properties": {
        "email": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-43, BT-58: an address as printed",
          "title": "Email"
        },
        "phone": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-42, BT-57: as printed",
          "title": "Phone"
        }
      },
      "title": "Contact",
      "type": "object"
    },
    "Deduction": {
      "description": "A final invoice's: an earlier invoice it takes off.",
      "properties": {
        "gross": {
          "anyOf": [
            {
              "description": "A decimal as a string, never a number",
              "examples": [
                "1270.92"
              ],
              "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Gross"
        },
        "issue_date": {
          "anyOf": [
            {
              "format": "date",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Issue Date"
        },
        "net": {
          "anyOf": [
            {
              "description": "A decimal as a string, never a number",
              "examples": [
                "1270.92"
              ],
              "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Net"
        },
        "number": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Number"
        },
        "tax": {
          "anyOf": [
            {
              "description": "A decimal as a string, never a number",
              "examples": [
                "1270.92"
              ],
              "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Tax"
        }
      },
      "title": "Deduction",
      "type": "object"
    },
    "Direction": {
      "description": "Whether the business received or issued it.\n\n- `incoming`: To the business: a supplier's\n- `outgoing`: The business issued it\n- `unsure`: Its parties don't say",
      "enum": [
        "incoming",
        "outgoing",
        "unsure"
      ],
      "title": "Direction",
      "type": "string"
    },
    "EarlyPaymentDiscount": {
      "description": "Skonto: XRechnung's #SKONTO# in BT-20.",
      "properties": {
        "base_amount": {
          "anyOf": [
            {
              "description": "A decimal as a string, never a number",
              "examples": [
                "1270.92"
              ],
              "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "What it is taken off, where printed; null: the amount due",
          "title": "Base Amount"
        },
        "days": {
          "title": "Days",
          "type": "integer"
        },
        "due_date": {
          "anyOf": [
            {
              "format": "date",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The last day for it: the issue date plus `days`",
          "title": "Due Date"
        },
        "percent": {
          "description": "2 for 2 %",
          "examples": [
            "1270.92"
          ],
          "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
          "title": "Percent",
          "type": "string"
        }
      },
      "required": [
        "days",
        "percent"
      ],
      "title": "EarlyPaymentDiscount",
      "type": "object"
    },
    "Fact": {
      "properties": {
        "amount": {
          "anyOf": [
            {
              "description": "A decimal as a string, never a number",
              "examples": [
                "1270.92"
              ],
              "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Amount"
        },
        "currency": {
          "anyOf": [
            {
              "examples": [
                "EUR"
              ],
              "pattern": "^[A-Z]{3}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "ISO 4217, of `amount`",
          "title": "Currency"
        },
        "date": {
          "anyOf": [
            {
              "format": "date",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Date"
        },
        "kind": {
          "$ref": "#/$defs/FactKind"
        },
        "label": {
          "description": "What it is, in the document's words",
          "title": "Label",
          "type": "string"
        },
        "number": {
          "anyOf": [
            {
              "description": "A decimal as a string, never a number",
              "examples": [
                "1270.92"
              ],
              "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Number"
        },
        "page": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Page"
        },
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Text"
        }
      },
      "required": [
        "label",
        "kind"
      ],
      "title": "Fact",
      "type": "object"
    },
    "FactKind": {
      "description": "What a fact on a document's card is.\n\n- `deadline`: A date something is due by; its label says what\n- `valid_from`: The day it is valid from\n- `valid_until`: The day it is valid until\n- `reference`: A number naming something else\n- `amount`: An amount\n- `party`: Someone besides its issuer and recipient\n- `date`: Any other date: an inspection, an acceptance\n- `other`: Anything else",
      "enum": [
        "deadline",
        "valid_from",
        "valid_until",
        "reference",
        "amount",
        "party",
        "date",
        "other"
      ],
      "title": "FactKind",
      "type": "string"
    },
    "Kind": {
      "description": "What a document is, grouped so an integrator branches on few; the exact kind is `kind_detail`.\n\n- `invoice`: An invoice to pay: partial, final, advance, collective, recurring, self-billed (`type_code` says which)\n- `credit_note`: A credit note\n- `invoice_correction`: A corrected invoice\n- `receipt`: A receipt: paid already\n- `pro_forma`: A pro forma invoice: not to pay\n- `delivery_note`: A delivery note\n- `order`: An order: a purchase, service, work or project order\n- `order_confirmation`: An order's or a reservation's confirmation\n- `quote`: A quote (offer)\n- `contract`: A contract: agreements, leases, insurance policies, mandates\n- `statement`: A factor's statement\n- `payment_reminder`: A payment reminder\n- `other`: Anything else: `kind_detail` and `card` say what",
      "enum": [
        "invoice",
        "credit_note",
        "invoice_correction",
        "receipt",
        "pro_forma",
        "delivery_note",
        "order",
        "order_confirmation",
        "quote",
        "contract",
        "statement",
        "payment_reminder",
        "other"
      ],
      "title": "Kind",
      "type": "string"
    },
    "KindDetail": {
      "description": "The exact kind, one of Ocost's document types, for information: branch on `kind`, which groups them (the guide's reference lists which).",
      "enum": [
        "acceptance_protocol",
        "agreement",
        "bonus_payment_notification",
        "certificate",
        "certificate_of_destruction",
        "collective_invoice",
        "contract",
        "cost_statement",
        "court_order",
        "credit_note",
        "reimbursement",
        "customer_statistics",
        "decision",
        "delivery_note",
        "final_report",
        "lump_sum_overview",
        "test_report",
        "insurance_policy",
        "invoice",
        "invoice_correction",
        "laboratory_report",
        "logistics_appendix",
        "maintenance_log",
        "maintenance_report",
        "mandate",
        "request_for_medical_consultation",
        "notification",
        "offer",
        "order",
        "order_confirmation",
        "order_form",
        "payment_reminder",
        "payroll",
        "pay_slip",
        "prescription",
        "project_order",
        "work_record",
        "receipt",
        "recommendation",
        "lease_contract",
        "report",
        "inquiry",
        "requirement",
        "reservation_confirmation",
        "separator_sheet",
        "service_order",
        "service_report",
        "service_documentation",
        "declaration",
        "time_sheet",
        "work_order",
        "work_report",
        "recurring_rental_invoice",
        "settlement_amount",
        "electronic_summary",
        "administrative_fee",
        "payment_voucher",
        "pro_forma_invoice",
        "copy_of_invoice",
        "bailiff",
        "membership_fee",
        "statement",
        "enforcement_case",
        "information",
        "fee_invoice",
        "cost_calculation",
        "fee_notice",
        "advance_payment_invoice",
        "invoice_audit",
        "credit_invoice",
        "final_invoice",
        "partial_invoice",
        "annex",
        "direct_debit_advice",
        "process_history",
        "internal_project_information",
        "bank_transaction_report",
        "purchase_order",
        "request_for_quotation",
        "rejection",
        "form"
      ],
      "title": "KindDetail",
      "type": "string"
    },
    "Line": {
      "description": "BG-25.",
      "properties": {
        "attributes": {
          "additionalProperties": {
            "type": "string"
          },
          "description": "What it is, as printed: colour, size, material, brand, …",
          "title": "Attributes",
          "type": "object"
        },
        "backordered_quantity": {
          "anyOf": [
            {
              "description": "A decimal as a string, never a number",
              "examples": [
                "1270.92"
              ],
              "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Still to come",
          "title": "Backordered Quantity"
        },
        "base_quantity": {
          "anyOf": [
            {
              "description": "A decimal as a string, never a number",
              "examples": [
                "1270.92"
              ],
              "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-149: how many units `price` is for; null: one",
          "title": "Base Quantity"
        },
        "batch": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Its batch (Charge), as printed",
          "title": "Batch"
        },
        "discount_percent": {
          "anyOf": [
            {
              "description": "A decimal as a string, never a number",
              "examples": [
                "1270.92"
              ],
              "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The line's discount: 5",
          "title": "Discount Percent"
        },
        "id": {
          "description": "BT-126: its position",
          "title": "Id",
          "type": "string"
        },
        "name": {
          "description": "BT-153",
          "title": "Name",
          "type": "string"
        },
        "net_amount": {
          "anyOf": [
            {
              "description": "A decimal as a string, never a number",
              "examples": [
                "1270.92"
              ],
              "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-131",
          "title": "Net Amount"
        },
        "ordered_quantity": {
          "anyOf": [
            {
              "description": "A decimal as a string, never a number",
              "examples": [
                "1270.92"
              ],
              "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A delivery note's",
          "title": "Ordered Quantity"
        },
        "price": {
          "anyOf": [
            {
              "description": "A decimal as a string, never a number",
              "examples": [
                "1270.92"
              ],
              "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-146: the net price",
          "title": "Price"
        },
        "pzn": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A medicine's PZN",
          "title": "Pzn"
        },
        "quantity": {
          "anyOf": [
            {
              "description": "A decimal as a string, never a number",
              "examples": [
                "1270.92"
              ],
              "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-129",
          "title": "Quantity"
        },
        "seller_item_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-155: the article number",
          "title": "Seller Item Id"
        },
        "standard_item_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-157: the GTIN (scheme 0160)",
          "title": "Standard Item Id"
        },
        "unit": {
          "anyOf": [
            {
              "examples": [
                "C62",
                "XCT"
              ],
              "pattern": "^[0-9A-Z]{2,3}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-130: UNECE Rec 20 (C62, HUR, KGM) or Rec 21 (XCT); null when none is printed or it is no code",
          "title": "Unit"
        },
        "vat_category": {
          "anyOf": [
            {
              "$ref": "#/$defs/VatCategory"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-151"
        },
        "vat_rate": {
          "anyOf": [
            {
              "description": "A decimal as a string, never a number",
              "examples": [
                "1270.92"
              ],
              "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-152, percent",
          "title": "Vat Rate"
        }
      },
      "required": [
        "id",
        "name",
        "attributes"
      ],
      "title": "Line",
      "type": "object"
    },
    "Means": {
      "description": "How it is paid, as a word.\n\n- `transfer`: A credit transfer (`means_code` 58)\n- `direct_debit`: A direct debit (59)\n- `card`: A card (48)\n- `already_paid`: It says it is paid already (no code)",
      "enum": [
        "transfer",
        "direct_debit",
        "card",
        "already_paid"
      ],
      "title": "Means",
      "type": "string"
    },
    "MeansCode": {
      "description": "BT-81: how it is paid, UNCL 4461.\n\n- `58`: SEPA credit transfer\n- `59`: SEPA direct debit\n- `48`: Bank card",
      "enum": [
        "58",
        "59",
        "48"
      ],
      "title": "MeansCode",
      "type": "string"
    },
    "OtherParty": {
      "properties": {
        "address": {
          "anyOf": [
            {
              "$ref": "#/$defs/Address"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BG-5, BG-8"
        },
        "contact": {
          "anyOf": [
            {
              "$ref": "#/$defs/Contact"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BG-6, BG-9"
        },
        "legal_registration_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-30, BT-47: the register entry (HRB …)",
          "title": "Legal Registration Id"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-27 (seller), BT-44 (buyer)",
          "title": "Name"
        },
        "printed_role": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The words printed for its role",
          "title": "Printed Role"
        },
        "role": {
          "$ref": "#/$defs/PartyRole",
          "description": "What it is to the document"
        },
        "tax_registration_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-32: the tax number (Steuernummer)",
          "title": "Tax Registration Id"
        },
        "vat_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-31, BT-48",
          "title": "Vat Id"
        },
        "website": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "As printed: a host, with or without its scheme",
          "title": "Website"
        }
      },
      "required": [
        "role"
      ],
      "title": "OtherParty",
      "type": "object"
    },
    "Party": {
      "properties": {
        "address": {
          "anyOf": [
            {
              "$ref": "#/$defs/Address"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BG-5, BG-8"
        },
        "contact": {
          "anyOf": [
            {
              "$ref": "#/$defs/Contact"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BG-6, BG-9"
        },
        "legal_registration_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-30, BT-47: the register entry (HRB …)",
          "title": "Legal Registration Id"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-27 (seller), BT-44 (buyer)",
          "title": "Name"
        },
        "tax_registration_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-32: the tax number (Steuernummer)",
          "title": "Tax Registration Id"
        },
        "vat_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-31, BT-48",
          "title": "Vat Id"
        },
        "website": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "As printed: a host, with or without its scheme",
          "title": "Website"
        }
      },
      "title": "Party",
      "type": "object"
    },
    "PartyRole": {
      "description": "What another party is to the document; `printed_role` is its words.\n\n- `seller`: The seller\n- `buyer`: The buyer\n- `invoicee`: Who it is addressed to, when not the buyer (Rechnungsempfänger)\n- `service_recipient`: Who receives the service, when not the buyer (Leistungsempfänger)\n- `payer`: Who pays, when not the buyer\n- `payee`: Who is paid, when not the seller\n- `ship_to`: Where the goods go (Warenempfänger)\n- `carrier`: Who carries the goods\n- `factor`: Who bought the receivable\n- `debtor`: Whose receivable it is (a factor's debtor)\n- `guarantor`: Who guarantees it (Bürge)\n- `landlord`: The landlord\n- `tenant`: The tenant\n- `subtenant`: The subtenant\n- `contractor`: The contractor\n- `subcontractor`: The subcontractor\n- `principal`: Who commissions the work (Auftraggeber, Bauherr)\n- `agent`: Who acts for a party: a property manager, a broker\n- `insurer`: The insurer\n- `policyholder`: The policyholder\n- `other`: Any other role: `printed_role` says which",
      "enum": [
        "seller",
        "buyer",
        "invoicee",
        "service_recipient",
        "payer",
        "payee",
        "ship_to",
        "carrier",
        "factor",
        "debtor",
        "guarantor",
        "landlord",
        "tenant",
        "subtenant",
        "contractor",
        "subcontractor",
        "principal",
        "agent",
        "insurer",
        "policyholder",
        "other"
      ],
      "title": "PartyRole",
      "type": "string"
    },
    "Payment": {
      "description": "BG-16.",
      "properties": {
        "bic": {
          "anyOf": [
            {
              "examples": [
                "BYLADEM1001"
              ],
              "pattern": "^[A-Z]{6}[0-9A-Z]{2}([0-9A-Z]{3})?$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-86",
          "title": "Bic"
        },
        "iban": {
          "anyOf": [
            {
              "examples": [
                "DE02120300000000202051"
              ],
              "pattern": "^[A-Z]{2}[0-9]{2}[0-9A-Z]{11,30}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-84, without spaces",
          "title": "Iban"
        },
        "means": {
          "anyOf": [
            {
              "$ref": "#/$defs/Means"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The same, as a word"
        },
        "means_code": {
          "anyOf": [
            {
              "$ref": "#/$defs/MeansCode"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-81, UNCL 4461; null when it doesn't say or it was paid already"
        },
        "net_days": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The days the terms give to pay in full from the issue date",
          "title": "Net Days"
        },
        "paid_on": {
          "anyOf": [
            {
              "format": "date",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The day it says it was paid or charged, where printed",
          "title": "Paid On"
        },
        "terms": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-20, as printed",
          "title": "Terms"
        }
      },
      "title": "Payment",
      "type": "object"
    },
    "ReadWith": {
      "description": "How Ocost read it: never a model's or provider's name.\n\n- `e_invoice`: From its XML, exactly\n- `reader`: From its pages",
      "enum": [
        "e_invoice",
        "reader"
      ],
      "title": "ReadWith",
      "type": "string"
    },
    "Source": {
      "description": "Where a value was read, and how sure Ocost is of it.",
      "properties": {
        "confidence": {
          "$ref": "#/$defs/Confidence"
        },
        "page": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Where it was read, from 1",
          "title": "Page"
        },
        "quote": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The words it was read from",
          "title": "Quote"
        },
        "why": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "For a doubt: the failed check's `name`",
          "title": "Why"
        }
      },
      "required": [
        "confidence"
      ],
      "title": "Source",
      "type": "object"
    },
    "TaxCase": {
      "description": "Which German rules an incoming invoice is held to.\n\n- `standard`: § 14 Abs. 4 UStG: an invoice with VAT\n- `small`: § 33 UStDV: a small amount, up to 250 €\n- `reverse_charge`: § 13b, § 14a Abs. 5 UStG: the business owes the VAT\n- `intra_eu`: § 14a Abs. 3 UStG: an intra-community supply\n- `exempt`: § 14 Abs. 4 Satz 1 Nr. 8 UStG: an exempt supply",
      "enum": [
        "standard",
        "small",
        "reverse_charge",
        "intra_eu",
        "exempt"
      ],
      "title": "TaxCase",
      "type": "string"
    },
    "TaxCheck": {
      "description": "An incoming invoice's § 14 UStG check (Germany's rules).",
      "properties": {
        "case": {
          "$ref": "#/$defs/TaxCase"
        },
        "missing": {
          "items": {
            "$ref": "#/$defs/TaxItem"
          },
          "title": "Missing",
          "type": "array"
        }
      },
      "required": [
        "case",
        "missing"
      ],
      "title": "TaxCheck",
      "type": "object"
    },
    "TaxItem": {
      "properties": {
        "at_stake": {
          "description": "Missing, it costs the input VAT deduction",
          "title": "At Stake",
          "type": "boolean"
        },
        "item": {
          "$ref": "#/$defs/TaxItemKind"
        },
        "law": {
          "description": "The paragraph that asks for it",
          "title": "Law",
          "type": "string"
        }
      },
      "required": [
        "item",
        "law",
        "at_stake"
      ],
      "title": "TaxItem",
      "type": "object"
    },
    "TaxItemKind": {
      "description": "What an invoice lacks, or has wrong, for its case.\n\n- `supplier_name`: The supplier's full name\n- `supplier_address`: The supplier's full address\n- `supplier_tax_id`: The supplier's tax number or VAT ID\n- `recipient_name`: The recipient's full name\n- `recipient_address`: The recipient's full address\n- `recipient_not_us`: It is addressed to someone else than the business\n- `recipient_address_not_ours`: It is addressed to an address that isn't the business's\n- `issued_on`: The issue date\n- `number`: The invoice number\n- `description`: The quantity and kind of the goods or services\n- `service_date`: The day of the supply or service\n- `net`: The net per rate\n- `tax_rate`: The VAT rate\n- `tax_amount`: The VAT\n- `exemption_note`: The note on why it is exempt\n- `reverse_charge_note`: The note that the recipient owes the VAT (Steuerschuldnerschaft des Leistungsempfängers)\n- `intra_eu_note`: The note that it is an intra-community supply\n- `supplier_vat_id`: The supplier's VAT ID\n- `recipient_vat_id`: The recipient's VAT ID\n- `vat_charged`: German VAT charged where the business owes it itself (§ 13b): not deductible, and paying it pays VAT twice",
      "enum": [
        "supplier_name",
        "supplier_address",
        "supplier_tax_id",
        "recipient_name",
        "recipient_address",
        "recipient_not_us",
        "recipient_address_not_ours",
        "issued_on",
        "number",
        "description",
        "service_date",
        "net",
        "tax_rate",
        "tax_amount",
        "exemption_note",
        "reverse_charge_note",
        "intra_eu_note",
        "supplier_vat_id",
        "recipient_vat_id",
        "vat_charged"
      ],
      "title": "TaxItemKind",
      "type": "string"
    },
    "Totals": {
      "description": "BG-22.",
      "properties": {
        "gross": {
          "anyOf": [
            {
              "description": "A decimal as a string, never a number",
              "examples": [
                "1270.92"
              ],
              "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-112",
          "title": "Gross"
        },
        "net": {
          "anyOf": [
            {
              "description": "A decimal as a string, never a number",
              "examples": [
                "1270.92"
              ],
              "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-109",
          "title": "Net"
        },
        "payable": {
          "anyOf": [
            {
              "description": "A decimal as a string, never a number",
              "examples": [
                "1270.92"
              ],
              "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-115: what is left to pay; null when it is the gross",
          "title": "Payable"
        },
        "prices_include_vat": {
          "description": "Its lines' prices and amounts include VAT (a receipt)",
          "title": "Prices Include Vat",
          "type": "boolean"
        },
        "tax": {
          "anyOf": [
            {
              "description": "A decimal as a string, never a number",
              "examples": [
                "1270.92"
              ],
              "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-110",
          "title": "Tax"
        }
      },
      "required": [
        "prices_include_vat"
      ],
      "title": "Totals",
      "type": "object"
    },
    "VatCategory": {
      "description": "BT-118, BT-151: the VAT category, UNCL 5305 as EN 16931 uses it.\n\n- `S`: Standard rate\n- `Z`: Zero rated goods\n- `E`: Exempt from VAT\n- `AE`: Reverse charge: the buyer owes the VAT\n- `K`: Intra-community supply, VAT exempt\n- `G`: Export outside the EU, free of VAT\n- `O`: Outside the scope of VAT\n- `L`: Canary Islands' IGIC\n- `M`: Ceuta and Melilla's IPSI\n- `B`: Transferred VAT (Italy's split payment)",
      "enum": [
        "S",
        "Z",
        "E",
        "AE",
        "K",
        "G",
        "O",
        "L",
        "M",
        "B"
      ],
      "title": "VatCategory",
      "type": "string"
    },
    "VatGroup": {
      "description": "BG-23.",
      "properties": {
        "category": {
          "anyOf": [
            {
              "$ref": "#/$defs/VatCategory"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-118"
        },
        "exemption_reason": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-120",
          "title": "Exemption Reason"
        },
        "rate": {
          "anyOf": [
            {
              "description": "A decimal as a string, never a number",
              "examples": [
                "1270.92"
              ],
              "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-119, percent: 19",
          "title": "Rate"
        },
        "tax_amount": {
          "description": "BT-117",
          "examples": [
            "1270.92"
          ],
          "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
          "title": "Tax Amount",
          "type": "string"
        },
        "taxable_amount": {
          "description": "BT-116",
          "examples": [
            "1270.92"
          ],
          "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
          "title": "Taxable Amount",
          "type": "string"
        }
      },
      "required": [
        "taxable_amount",
        "tax_amount"
      ],
      "title": "VatGroup",
      "type": "object"
    },
    "WorkedOut": {
      "description": "An amount Ocost worked out because the one read can't be it.",
      "properties": {
        "field": {
          "$ref": "#/$defs/WorkedOutField",
          "description": "Its path in this document"
        },
        "printed": {
          "anyOf": [
            {
              "description": "A decimal as a string, never a number",
              "examples": [
                "1270.92"
              ],
              "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "What was read",
          "title": "Printed"
        },
        "rule": {
          "$ref": "#/$defs/WorkedOutRule"
        }
      },
      "required": [
        "field",
        "rule"
      ],
      "title": "WorkedOut",
      "type": "object"
    },
    "WorkedOutField": {
      "description": "The amount worked out, by its path.\n\n- `totals.net`: BT-109\n- `totals.tax`: BT-110\n- `totals.gross`: BT-112",
      "enum": [
        "totals.net",
        "totals.tax",
        "totals.gross"
      ],
      "title": "WorkedOutField",
      "type": "string"
    },
    "WorkedOutRule": {
      "description": "How Ocost worked an amount out.\n\n- `groups`: The VAT groups' sum\n- `net_tax`: Net plus VAT\n- `skonto`: The gross read was the amount less Skonto\n- `payable`: The gross read was what is left to pay\n- `outside`: The net with an amount outside the VAT groups: a deposit, a tip",
      "enum": [
        "groups",
        "net_tax",
        "skonto",
        "payable",
        "outside"
      ],
      "title": "WorkedOutRule",
      "type": "string"
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "ocost.document.v1: one document as Ocost read it.",
  "examples": [
    {
      "attention": [],
      "buyer": {
        "address": {
          "city": "Düsseldorf",
          "country": "DE",
          "postal_code": "40213",
          "street": "Hauptstraße 1"
        },
        "contact": null,
        "legal_registration_id": null,
        "name": "Beispiel Handel GmbH",
        "tax_registration_id": null,
        "vat_id": "DE987654321",
        "website": null
      },
      "buyer_reference": null,
      "card": null,
      "checks": [
        {
          "at": "19",
          "fields": [
            "totals.net",
            "totals.tax"
          ],
          "name": "vat",
          "passed": true,
          "sums": true
        },
        {
          "at": null,
          "fields": [
            "totals.net",
            "totals.tax",
            "totals.gross"
          ],
          "name": "gross",
          "passed": true,
          "sums": true
        }
      ],
      "currency": "EUR",
      "deductions": [],
      "deliver_to": null,
      "delivery_date": "2026-10-30",
      "direction": "incoming",
      "due_date": "2026-12-03",
      "early_payment_discounts": [
        {
          "base_amount": null,
          "days": 14,
          "due_date": "2026-11-17",
          "percent": "2"
        }
      ],
      "file_id": "01a1b08c-6e3a-7562-8f4a-7924722667b1",
      "id": "01a1b08c-7aa1-7b52-9d4e-2f1f1c0c4f11",
      "invoicing_period_end": null,
      "invoicing_period_start": null,
      "issue_date": "2026-11-03",
      "kind": "invoice",
      "kind_detail": "invoice",
      "lines": [
        {
          "attributes": {
            "colour": "schwarz"
          },
          "backordered_quantity": null,
          "base_quantity": null,
          "batch": null,
          "discount_percent": null,
          "id": "1",
          "name": "Bürostuhl ErgoPlus schwarz",
          "net_amount": "756.00",
          "ordered_quantity": null,
          "price": "189.00",
          "pzn": null,
          "quantity": "4",
          "seller_item_id": "ES-200",
          "standard_item_id": null,
          "unit": "H87",
          "vat_category": "S",
          "vat_rate": "19"
        },
        {
          "attributes": {},
          "backordered_quantity": null,
          "base_quantity": null,
          "batch": null,
          "discount_percent": null,
          "id": "2",
          "name": "Montage",
          "net_amount": "312.00",
          "ordered_quantity": null,
          "price": "78.00",
          "pzn": null,
          "quantity": "4",
          "seller_item_id": null,
          "standard_item_id": null,
          "unit": "HUR",
          "vat_category": "S",
          "vat_rate": "19"
        }
      ],
      "number": "RE-2026-1187",
      "order_reference": "PO-2316",
      "order_references": [
        "PO-2316"
      ],
      "other_parties": [],
      "pages": [
        1
      ],
      "payee": null,
      "payment": {
        "bic": null,
        "iban": "DE02120300000000202051",
        "means": "transfer",
        "means_code": "58",
        "net_days": 30,
        "paid_on": null,
        "terms": "14 Tage 2 % Skonto, 30 Tage netto"
      },
      "possible_duplicate_of": null,
      "preceding_invoice": null,
      "read_with": "reader",
      "schema": "ocost.document.v1",
      "seller": {
        "address": {
          "city": "Köln",
          "country": "DE",
          "postal_code": "50667",
          "street": "Beispielweg 4"
        },
        "contact": {
          "email": "rechnung@lieferant.example",
          "phone": null
        },
        "legal_registration_id": "HRB 12345",
        "name": "Musterbüro Lieferant GmbH",
        "tax_registration_id": null,
        "vat_id": "DE123456789",
        "website": null
      },
      "sources": {
        "number": {
          "confidence": "read",
          "page": 1,
          "quote": "RE-2026-1187",
          "why": null
        },
        "seller.vat_id": {
          "confidence": "checked",
          "page": 1,
          "quote": "DE123456789",
          "why": null
        },
        "totals.gross": {
          "confidence": "checked",
          "page": 1,
          "quote": "1.270,92 €",
          "why": null
        }
      },
      "tax_check": {
        "case": "standard",
        "missing": []
      },
      "totals": {
        "gross": "1270.92",
        "net": "1068.00",
        "payable": null,
        "prices_include_vat": false,
        "tax": "202.92"
      },
      "type_code": "380",
      "valid_until": null,
      "vat_breakdown": [
        {
          "category": "S",
          "exemption_reason": null,
          "rate": "19",
          "tax_amount": "202.92",
          "taxable_amount": "1068.00"
        }
      ],
      "worked_out": []
    }
  ],
  "properties": {
    "attention": {
      "items": {
        "$ref": "#/$defs/Attention"
      },
      "title": "Attention",
      "type": "array"
    },
    "buyer": {
      "anyOf": [
        {
          "$ref": "#/$defs/Party"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "BG-7"
    },
    "buyer_reference": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "BT-10",
      "title": "Buyer Reference"
    },
    "card": {
      "anyOf": [
        {
          "$ref": "#/$defs/Card"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "checks": {
      "items": {
        "$ref": "#/$defs/Check"
      },
      "title": "Checks",
      "type": "array"
    },
    "currency": {
      "anyOf": [
        {
          "examples": [
            "EUR"
          ],
          "pattern": "^[A-Z]{3}$",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "BT-5, ISO 4217",
      "title": "Currency"
    },
    "deductions": {
      "items": {
        "$ref": "#/$defs/Deduction"
      },
      "title": "Deductions",
      "type": "array"
    },
    "deliver_to": {
      "anyOf": [
        {
          "$ref": "#/$defs/Address"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "BG-15"
    },
    "delivery_date": {
      "anyOf": [
        {
          "format": "date",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "BT-72",
      "title": "Delivery Date"
    },
    "direction": {
      "$ref": "#/$defs/Direction"
    },
    "due_date": {
      "anyOf": [
        {
          "format": "date",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "BT-9",
      "title": "Due Date"
    },
    "early_payment_discounts": {
      "items": {
        "$ref": "#/$defs/EarlyPaymentDiscount"
      },
      "title": "Early Payment Discounts",
      "type": "array"
    },
    "file_id": {
      "description": "The file it is in",
      "format": "uuid",
      "title": "File Id",
      "type": "string"
    },
    "id": {
      "description": "The document",
      "format": "uuid",
      "title": "Id",
      "type": "string"
    },
    "invoicing_period_end": {
      "anyOf": [
        {
          "format": "date",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "BT-74",
      "title": "Invoicing Period End"
    },
    "invoicing_period_start": {
      "anyOf": [
        {
          "format": "date",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "BT-73",
      "title": "Invoicing Period Start"
    },
    "issue_date": {
      "anyOf": [
        {
          "format": "date",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "BT-2",
      "title": "Issue Date"
    },
    "kind": {
      "$ref": "#/$defs/Kind"
    },
    "kind_detail": {
      "$ref": "#/$defs/KindDetail"
    },
    "lines": {
      "items": {
        "$ref": "#/$defs/Line"
      },
      "title": "Lines",
      "type": "array"
    },
    "number": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "BT-1",
      "title": "Number"
    },
    "order_reference": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "BT-13",
      "title": "Order Reference"
    },
    "order_references": {
      "description": "Every order it names",
      "items": {
        "type": "string"
      },
      "title": "Order References",
      "type": "array"
    },
    "other_parties": {
      "description": "Every other party named",
      "items": {
        "$ref": "#/$defs/OtherParty"
      },
      "title": "Other Parties",
      "type": "array"
    },
    "pages": {
      "description": "Its pages in the file, from 1",
      "items": {
        "type": "integer"
      },
      "title": "Pages",
      "type": "array"
    },
    "payee": {
      "anyOf": [
        {
          "$ref": "#/$defs/Party"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "BG-10: when not the seller"
    },
    "payment": {
      "$ref": "#/$defs/Payment"
    },
    "possible_duplicate_of": {
      "anyOf": [
        {
          "format": "uuid",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "An earlier document of the same kind, number and seller",
      "title": "Possible Duplicate Of"
    },
    "preceding_invoice": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "BT-25",
      "title": "Preceding Invoice"
    },
    "read_with": {
      "$ref": "#/$defs/ReadWith"
    },
    "schema": {
      "const": "ocost.document.v1",
      "default": "ocost.document.v1",
      "description": "Always this",
      "title": "Schema",
      "type": "string"
    },
    "seller": {
      "anyOf": [
        {
          "$ref": "#/$defs/Party"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "BG-4"
    },
    "sources": {
      "description": "Per value, by its path: `number`, `issue_date`, `due_date`, `delivery_date`, `valid_until`, `currency`, `order_reference`, `seller.name`, `buyer.name`, `seller.vat_id`, `buyer.vat_id`, `seller.contact.email`, `buyer.contact.email`, `seller.contact.phone`, `buyer.contact.phone`, `seller.website`, `buyer.website`, `seller.legal_registration_id`, `buyer.legal_registration_id`, `totals.net`, `totals.tax`, `totals.gross`, `totals.payable`, `payment.iban`, `payment.means_code`, `payment.paid_on`, `lines`, `other_parties[n].name`, `deductions[n].gross`; a later Ocost may add paths",
      "patternProperties": {
        "^[a-z_]+(\\[[0-9]+\\])?(\\.[a-z_]+)*$": {
          "$ref": "#/$defs/Source"
        }
      },
      "propertyNames": {
        "examples": [
          "totals.gross"
        ]
      },
      "title": "Sources",
      "type": "object"
    },
    "tax_check": {
      "anyOf": [
        {
          "$ref": "#/$defs/TaxCheck"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "totals": {
      "$ref": "#/$defs/Totals"
    },
    "type_code": {
      "anyOf": [
        {
          "examples": [
            "380"
          ],
          "pattern": "^[0-9]{1,3}$",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "BT-3, UNCL 1001: 380 commercial invoice, 381 credit note, 384 corrected invoice, 389 self-billed invoice, 326 partial invoice, 386 prepayment invoice, 325 pro forma invoice, 875 partial construction invoice, 876 partial final construction invoice, 877 final construction invoice, 383 debit note, 393 factored invoice, 751 invoice information for accounting purposes, 81 credit note related to goods or services, 83 credit note related to financial adjustments, 261 self-billed credit note, 262 consolidated credit note, goods and services, 396 factored credit note, 532 forwarder's credit note; an e-invoice may carry another",
      "title": "Type Code"
    },
    "valid_until": {
      "anyOf": [
        {
          "format": "date",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "A quote's",
      "title": "Valid Until"
    },
    "vat_breakdown": {
      "items": {
        "$ref": "#/$defs/VatGroup"
      },
      "title": "Vat Breakdown",
      "type": "array"
    },
    "worked_out": {
      "items": {
        "$ref": "#/$defs/WorkedOut"
      },
      "title": "Worked Out",
      "type": "array"
    }
  },
  "required": [
    "id",
    "file_id",
    "pages",
    "kind",
    "kind_detail",
    "direction",
    "order_references",
    "other_parties",
    "payment",
    "early_payment_discounts",
    "totals",
    "vat_breakdown",
    "lines",
    "deductions",
    "worked_out",
    "sources",
    "checks",
    "attention",
    "read_with"
  ],
  "title": "Document",
  "type": "object"
}
