{
  "$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"
    },
    "Box": {
      "description": "Where a value stands on its page: a rectangle in fractions of the\npage from its top-left corner (0 to 1, so any rendering's size), the\npage as `GET /files/{id}/content`'s pages show it (a PDF's /Rotate, an\nimage's EXIF orientation applied). From a PDF's own words exact; on a\nscan or a photo, the OCR's line and characters, an estimate.",
      "properties": {
        "x0": {
          "description": "Its left edge, from the page's left",
          "maximum": 1,
          "minimum": 0,
          "title": "X0",
          "type": "number"
        },
        "x1": {
          "description": "Its right edge, from the page's left",
          "maximum": 1,
          "minimum": 0,
          "title": "X1",
          "type": "number"
        },
        "y0": {
          "description": "Its top edge, from the page's top",
          "maximum": 1,
          "minimum": 0,
          "title": "Y0",
          "type": "number"
        },
        "y1": {
          "description": "Its bottom edge, from the page's top",
          "maximum": 1,
          "minimum": 0,
          "title": "Y1",
          "type": "number"
        }
      },
      "required": [
        "x0",
        "y0",
        "x1",
        "y1"
      ],
      "title": "Box",
      "type": "object"
    },
    "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- `line_tax`: A line's printed VAT is its net × rate, and its net plus VAT its printed gross (`at` the line)\n- `lines_tax`: The lines' printed VAT adds up to their VAT group's (`at` the rate)\n- `iban`: The IBAN's check digits hold\n- `vat_id`: A VAT ID has its country's format\n- `identifier`: A party's identifier has its length and check digit (`at` its scheme: an ЄДРПОУ, a РНОКПП, a NIP)\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",
        "line_tax",
        "lines_tax",
        "iban",
        "vat_id",
        "identifier",
        "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": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
              "examples": [
                1270.92
              ],
              "format": "decimal",
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Gross"
        },
        "issue_date": {
          "anyOf": [
            {
              "format": "date",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Issue Date"
        },
        "net": {
          "anyOf": [
            {
              "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
              "examples": [
                1270.92
              ],
              "format": "decimal",
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Net"
        },
        "number": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Number"
        },
        "tax": {
          "anyOf": [
            {
              "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
              "examples": [
                1270.92
              ],
              "format": "decimal",
              "type": "number"
            },
            {
              "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": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
              "examples": [
                1270.92
              ],
              "format": "decimal",
              "type": "number"
            },
            {
              "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
          ],
          "format": "decimal",
          "title": "Percent",
          "type": "number"
        }
      },
      "required": [
        "days",
        "percent"
      ],
      "title": "EarlyPaymentDiscount",
      "type": "object"
    },
    "Fact": {
      "properties": {
        "amount": {
          "anyOf": [
            {
              "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
              "examples": [
                1270.92
              ],
              "format": "decimal",
              "type": "number"
            },
            {
              "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": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
              "examples": [
                1270.92
              ],
              "format": "decimal",
              "type": "number"
            },
            {
              "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"
    },
    "Factor": {
      "description": "Who the receivable is assigned or sold to.",
      "properties": {
        "name": {
          "description": "As the assignment note prints it",
          "title": "Name",
          "type": "string"
        }
      },
      "required": [
        "name"
      ],
      "title": "Factor",
      "type": "object"
    },
    "IdentifierScheme": {
      "description": "What an identifier of a party is.\n\n- `UA_EDRPOU`: Ukraine: a legal entity's code ЄДРПОУ, 8 digits\n- `UA_RNOKPP`: Ukraine: a person's or sole trader's (ФОП) РНОКПП, 10 digits\n- `UA_IPN`: Ukraine: the VAT payer's number ІПН, 12 digits\n- `EU_VAT`: A VAT ID with its country prefix (also `vat_id`)\n- `DE_STNR`: Germany: a tax number, Steuernummer\n- `COMMERCIAL_REGISTER`: A register entry with its court (HRB 1234)\n- `PL_NIP`: Poland: NIP, 10 digits\n- `PL_REGON`: Poland: REGON, 9 or 14 digits\n- `PL_KRS`: Poland: KRS number, 10 digits\n- `GB_CRN`: UK: Companies House number, 8 digits or 2 letters and 6\n- `FR_SIREN`: France: SIREN, 9 digits\n- `FR_SIRET`: France: SIRET, 14 digits\n- `CZ_ICO`: Czechia: IČO, 8 digits\n- `RO_CUI`: Romania: CUI, 2 to 10 digits\n- `NO_ORGNR`: Norway: organisasjonsnummer, 9 digits\n- `FI_YTUNNUS`: Finland: Y-tunnus, 8 digits (without its dash)\n- `US_EIN`: United States: EIN, 9 digits\n- `US_STATE_FILE`: United States: a state's entity or file number\n- `MD_IDNO`: Moldova: IDNO, 13 digits\n- `MD_IDNP`: Moldova: a person's IDNP, 13 digits\n- `MD_VAT`: Moldova: cod TVA, 7 digits\n- `OTHER`: Any other number that identifies the party",
      "enum": [
        "UA_EDRPOU",
        "UA_RNOKPP",
        "UA_IPN",
        "EU_VAT",
        "DE_STNR",
        "COMMERCIAL_REGISTER",
        "PL_NIP",
        "PL_REGON",
        "PL_KRS",
        "GB_CRN",
        "FR_SIREN",
        "FR_SIRET",
        "CZ_ICO",
        "RO_CUI",
        "NO_ORGNR",
        "FI_YTUNNUS",
        "US_EIN",
        "US_STATE_FILE",
        "MD_IDNO",
        "MD_IDNP",
        "MD_VAT",
        "OTHER"
      ],
      "title": "IdentifierScheme",
      "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- `tax_invoice`: A tax invoice registered with the tax authority (a Ukrainian податкова накладна): VAT evidence, not to pay\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",
        "tax_invoice",
        "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",
        "tax_invoice"
      ],
      "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": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
              "examples": [
                1270.92
              ],
              "format": "decimal",
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Still to come",
          "title": "Backordered Quantity"
        },
        "base_quantity": {
          "anyOf": [
            {
              "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
              "examples": [
                1270.92
              ],
              "format": "decimal",
              "type": "number"
            },
            {
              "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": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
              "examples": [
                1270.92
              ],
              "format": "decimal",
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The line's discount: 5",
          "title": "Discount Percent"
        },
        "gross_amount": {
          "anyOf": [
            {
              "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
              "examples": [
                1270.92
              ],
              "format": "decimal",
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The line's total with VAT, only as printed on it; null when it prints none",
          "title": "Gross Amount"
        },
        "id": {
          "description": "BT-126: its position",
          "title": "Id",
          "type": "string"
        },
        "name": {
          "description": "BT-153",
          "title": "Name",
          "type": "string"
        },
        "net_amount": {
          "anyOf": [
            {
              "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
              "examples": [
                1270.92
              ],
              "format": "decimal",
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-131",
          "title": "Net Amount"
        },
        "ordered_quantity": {
          "anyOf": [
            {
              "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
              "examples": [
                1270.92
              ],
              "format": "decimal",
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A delivery note's",
          "title": "Ordered Quantity"
        },
        "price": {
          "anyOf": [
            {
              "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
              "examples": [
                1270.92
              ],
              "format": "decimal",
              "type": "number"
            },
            {
              "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": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
              "examples": [
                1270.92
              ],
              "format": "decimal",
              "type": "number"
            },
            {
              "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"
        },
        "tax_amount": {
          "anyOf": [
            {
              "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
              "examples": [
                1270.92
              ],
              "format": "decimal",
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The line's VAT, only as printed on it; null when it prints none",
          "title": "Tax Amount"
        },
        "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": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
              "examples": [
                1270.92
              ],
              "format": "decimal",
              "type": "number"
            },
            {
              "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"
        },
        "identifiers": {
          "default": [],
          "description": "Every identifier printed for it, by scheme (BT-29, BT-46 in any country): an ЄДРПОУ, a РНОКПП, an ІПН, a NIP, …",
          "items": {
            "$ref": "#/$defs/PartyIdentifier"
          },
          "title": "Identifiers",
          "type": "array"
        },
        "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"
        },
        "identifiers": {
          "default": [],
          "description": "Every identifier printed for it, by scheme (BT-29, BT-46 in any country): an ЄДРПОУ, a РНОКПП, an ІПН, a NIP, …",
          "items": {
            "$ref": "#/$defs/PartyIdentifier"
          },
          "title": "Identifiers",
          "type": "array"
        },
        "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"
    },
    "PartyIdentifier": {
      "properties": {
        "scheme": {
          "$ref": "#/$defs/IdentifierScheme"
        },
        "valid": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Its length and check digit hold; false: in doubt, a misread (never matched on); null: its scheme has no check",
          "title": "Valid"
        },
        "value": {
          "description": "Digits only for the schemes of digits, a VAT ID without spaces, any other as printed",
          "title": "Value",
          "type": "string"
        }
      },
      "required": [
        "scheme",
        "value"
      ],
      "title": "PartyIdentifier",
      "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": {
        "assigned_to": {
          "anyOf": [
            {
              "$ref": "#/$defs/Factor"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The factor its assignment note (Abtretung, Zession, factoring) names; `iban` is then the factor's"
        },
        "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"
        },
        "iban_holder": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-85: the holder of `iban`, as printed",
          "title": "Iban Holder"
        },
        "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": {
        "box": {
          "anyOf": [
            {
              "$ref": "#/$defs/Box"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Its rectangle on `page`; null when Ocost kept none (then `quote` is all there is)"
        },
        "confidence": {
          "$ref": "#/$defs/Confidence"
        },
        "page": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Where it was read: the file's page, 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\n- `vat_non_payer`: Ukraine: ПДВ charged by a supplier Ukraine's register says is no VAT payer (платник ПДВ): no tax credit for it\n- `supplier_idno`: Moldova: the supplier's IDNO\n- `supplier_vat_code`: Moldova: the supplier's VAT code (cod TVA), where it charges VAT\n- `vat_rate_unknown`: Moldova: a VAT rate other than 20 %, 8 % or 0 %",
      "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",
        "vat_non_payer",
        "supplier_idno",
        "supplier_vat_code",
        "vat_rate_unknown"
      ],
      "title": "TaxItemKind",
      "type": "string"
    },
    "TaxRegistration": {
      "description": "Where the tax authority registered a tax invoice (Ukraine's ЄРПН).",
      "properties": {
        "date": {
          "anyOf": [
            {
              "format": "date",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The day it was registered",
          "title": "Date"
        },
        "number": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Its registration number",
          "title": "Number"
        }
      },
      "title": "TaxRegistration",
      "type": "object"
    },
    "Totals": {
      "description": "BG-22.",
      "properties": {
        "gross": {
          "anyOf": [
            {
              "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
              "examples": [
                1270.92
              ],
              "format": "decimal",
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-112",
          "title": "Gross"
        },
        "net": {
          "anyOf": [
            {
              "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
              "examples": [
                1270.92
              ],
              "format": "decimal",
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-109",
          "title": "Net"
        },
        "payable": {
          "anyOf": [
            {
              "description": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
              "examples": [
                1270.92
              ],
              "format": "decimal",
              "type": "number"
            },
            {
              "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": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
              "examples": [
                1270.92
              ],
              "format": "decimal",
              "type": "number"
            },
            {
              "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": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
              "examples": [
                1270.92
              ],
              "format": "decimal",
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "BT-119, percent: 19",
          "title": "Rate"
        },
        "tax_amount": {
          "description": "BT-117",
          "examples": [
            1270.92
          ],
          "format": "decimal",
          "title": "Tax Amount",
          "type": "number"
        },
        "taxable_amount": {
          "description": "BT-116",
          "examples": [
            1270.92
          ],
          "format": "decimal",
          "title": "Taxable Amount",
          "type": "number"
        }
      },
      "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": "An exact decimal of at most 15 significant digits. Parse it as a decimal type before calculating",
              "examples": [
                1270.92
              ],
              "format": "decimal",
              "type": "number"
            },
            {
              "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\n- `tip`: The gross read was the amount paid: the bill and its tip, read apart",
      "enum": [
        "groups",
        "net_tax",
        "skonto",
        "payable",
        "outside",
        "tip"
      ],
      "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,
          "ordered_quantity": null,
          "price": 189,
          "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,
          "ordered_quantity": null,
          "price": 78,
          "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": {
        "assigned_to": null,
        "bic": null,
        "iban": "DE02120300000000202051",
        "iban_holder": null,
        "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": {
          "box": null,
          "confidence": "read",
          "page": 1,
          "quote": "RE-2026-1187",
          "why": null
        },
        "seller.vat_id": {
          "box": null,
          "confidence": "checked",
          "page": 1,
          "quote": "DE123456789",
          "why": null
        },
        "totals.gross": {
          "box": {
            "x0": 0.7012,
            "x1": 0.8874,
            "y0": 0.6831,
            "y1": 0.6995
          },
          "confidence": "checked",
          "page": 1,
          "quote": "1.270,92 €",
          "why": null
        }
      },
      "tax_check": {
        "case": "standard",
        "missing": []
      },
      "totals": {
        "gross": 1270.92,
        "net": 1068,
        "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
        }
      ],
      "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"
    },
    "contract_reference": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "BT-12: the contract it refers to (an act's)",
      "title": "Contract Reference"
    },
    "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; a tax invoice's: the invoice or act it is for",
      "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
    },
    "tax_registration": {
      "anyOf": [
        {
          "$ref": "#/$defs/TaxRegistration"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "A tax invoice's registration, where printed"
    },
    "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"
}
