{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.demiton.io/registers/purchase_line/v2.json",
  "title": "purchase_line contract v2",
  "type": "object",
  "required": [
    "amount",
    "currency",
    "document_number",
    "document_type",
    "financial_period",
    "line_number",
    "order_date",
    "project",
    "quantity",
    "unit_cost",
    "unit_of_measure"
  ],
  "properties": {
    "amount": {
      "type": "number",
      "description": "Line value. Raw `lineAmount`. ADDITIVE.",
      "x-demiton-requiredness": "required",
      "x-demiton-unit": "`by_coordinate` (row currency)",
      "x-demiton-type": "decimal"
    },
    "vendor": {
      "type": "string",
      "description": "The supplier the line is placed with. Raw `buyFromVendorNumber`. Optional because the declaration says so and the axis name is not portable.",
      "x-demiton-requiredness": "optional",
      "x-demiton-reference": true
    },
    "project": {
      "type": "string",
      "description": "The job the line commits cost against. Raw `jobNumber`; the bound filter already excludes rows without one (`jobNumber ne ''`, `baseline_squash_02_seed.sql:1198`).",
      "x-demiton-requiredness": "required",
      "x-demiton-reference": true
    },
    "currency": {
      "type": "currency",
      "description": "Denomination of `amount` and `unit_cost`. Raw `currencyCode`, falling back to company base currency when the field is empty.",
      "x-demiton-requiredness": "required",
      "x-demiton-unit": "ISO 4217 code",
      "x-demiton-reference": true
    },
    "quantity": {
      "type": "number",
      "description": "Line quantity. Raw `quantity`. ADDITIVE, `missing=ZERO`.",
      "x-demiton-requiredness": "required",
      "x-demiton-unit": "`dimensionless` (unit of measure is a separate attribute)"
    },
    "cost_code": {
      "type": "string",
      "description": "The job task / cost code the line is coded to. Raw `jobTaskNumber`.",
      "x-demiton-requiredness": "optional",
      "x-demiton-reference": true
    },
    "unit_cost": {
      "type": "number",
      "description": "Rate per unit. Raw `directUnitCost`. INSTANTANEOUS.",
      "x-demiton-requiredness": "required",
      "x-demiton-unit": "`by_coordinate`",
      "x-demiton-type": "decimal"
    },
    "order_date": {
      "type": "string",
      "description": "When the line was ordered. Raw `orderDate`; already the producer's `occurred_at_field`, so no new source is needed — this row records it in the payload too.",
      "x-demiton-requiredness": "required",
      "format": "date",
      "x-demiton-type": "date"
    },
    "description": {
      "type": "string",
      "description": "Line description. Raw `description`. Optional: no lens mandates it, but names it as what makes this shelf richer than `cost_element`.",
      "x-demiton-requiredness": "optional"
    },
    "line_number": {
      "type": "integer",
      "description": "Line identity within the document. Raw `lineNumber`. Second half of the composite id.",
      "x-demiton-requiredness": "required"
    },
    "legal_entity": {
      "type": "string",
      "description": "The company/legal entity that placed the order; supplied by company context rather than a per-row field.",
      "x-demiton-requiredness": "optional",
      "x-demiton-reference": true
    },
    "document_type": {
      "type": "string",
      "description": "Which purchase-document kind the line belongs to (order / invoice / credit memo). Raw `documentType`. Mandatory because the bound endpoint is not type-filtered while the sibling commitments query is, so without this field an invoice line is indistinguishable from a PO line.",
      "x-demiton-requiredness": "required"
    },
    "tax_area_code": {
      "type": "string",
      "description": "Tenant tax area coding. Raw `taxAreaCode`. Same reason.",
      "x-demiton-requiredness": "tenant-specific"
    },
    "item_reference": {
      "type": "string",
      "description": "The vendor's or tenant's item identifier. Raw `itemReferenceNumber` / `vendorItemNumber`.",
      "x-demiton-requiredness": "optional"
    },
    "tax_group_code": {
      "type": "string",
      "description": "Tenant tax group coding. Raw `taxGroupCode`. Same reason as `amount_including_tax`: tenant configuration vocabulary, no jurisdictional mandate on the order line.",
      "x-demiton-requiredness": "tenant-specific"
    },
    "document_number": {
      "type": "string",
      "description": "Purchase document identity. Raw `documentNumber`. Half of the composite external id; without it no line can be deduplicated or superseded.",
      "x-demiton-requiredness": "required"
    },
    "unit_of_measure": {
      "type": "string",
      "description": "The unit `quantity` is counted in. Raw `unitOfMeasureCode`. `quantity` is declared `dimensionless`, so the unit has to be carried as an attribute or the quantity is uninterpretable. Which of `unitOfMeasureCode` / `unitOfMeasure` is canonical is **unverified**; both are in the corpus.",
      "x-demiton-requiredness": "required"
    },
    "cost_dimension_1": {
      "type": "string",
      "description": "Tenant dimension code 1. Raw `shortcutDimension1Code`. Tenant-specific: BC dimension semantics are configured per tenant, and the shelf's portable cost axis is `cost_code`.",
      "x-demiton-requiredness": "tenant-specific"
    },
    "cost_dimension_2": {
      "type": "string",
      "description": "Tenant dimension code 2. Raw `shortcutDimension2Code`. Same reason.",
      "x-demiton-requiredness": "tenant-specific"
    },
    "financial_period": {
      "type": "string",
      "description": "The period the commitment is attributed to. Derived from `orderDate` by the period resolver, not a raw field.",
      "x-demiton-requiredness": "required",
      "x-demiton-reference": true
    },
    "received_complete": {
      "type": "boolean",
      "description": "Whether the line is fully received. Raw `completelyReceived` / `finished`. Tenant-specific because \"received\" is a workflow state of the tenant's procurement process, not a fact about the commitment.",
      "x-demiton-requiredness": "tenant-specific"
    },
    "receipt_expected_on": {
      "type": "string",
      "description": "Expected / promised / requested receipt date. Raw `expectedReceiptDate`, `promisedReceiptDate`, `requestedReceiptDate`. Optional: no lens requires a commitment to carry a delivery date, and the three raw fields disagree in meaning.",
      "x-demiton-requiredness": "optional",
      "format": "date",
      "x-demiton-type": "date"
    },
    "amount_including_tax": {
      "type": "number",
      "description": "Line value incl. tax. Raw `amountIncludingVat`. Tenant-specific: the R3 file is explicit that verified tax content rules attach to the invoice, not the order line (`payroll-and-invoicing.md:563-568`), and the tax rate/jurisdiction/rounding basis needed to reconcile it is not on this record (`:545-552`).",
      "x-demiton-requiredness": "tenant-specific",
      "x-demiton-unit": "tenant tax area",
      "x-demiton-type": "decimal"
    }
  },
  "x-demiton-register-type": "purchase_line",
  "x-demiton-contract-version": "2.0.1",
  "x-demiton-store": "tenant",
  "x-demiton-axes": [
    {
      "axis": "project",
      "requirement": "required",
      "role": "subject"
    },
    {
      "axis": "legal_entity",
      "requirement": "optional",
      "role": "context"
    },
    {
      "axis": "cost_code",
      "requirement": "optional",
      "role": "context"
    },
    {
      "axis": "vendor",
      "requirement": "optional",
      "role": "context"
    },
    {
      "axis": "currency",
      "requirement": "required",
      "role": "context"
    },
    {
      "axis": "financial_period",
      "requirement": "required",
      "role": "context"
    }
  ],
  "x-demiton-measures": [
    {
      "key": "amount",
      "accumulation": "additive",
      "dtype": "decimal",
      "unit": "by_coordinate"
    },
    {
      "key": "quantity",
      "accumulation": "additive",
      "dtype": "float",
      "unit": "dimensionless"
    },
    {
      "key": "unit_cost",
      "accumulation": "instantaneous",
      "dtype": "decimal",
      "unit": "by_coordinate"
    }
  ],
  "x-demiton-provenance": {
    "standards": [
      {
        "code": "ABN Act 1999 (Cth)",
        "title": "A New Tax System (Australian Business Number) Act 1999 - ABN register",
        "access": "public_summary",
        "region": "Australia",
        "edition": "current",
        "checked_on": "2026-09-14"
      },
      {
        "code": "GST Act 1999 (Cth)",
        "title": "A New Tax System (Goods and Services Tax) Act 1999 (Cth)",
        "access": "public_summary",
        "clause": "s 29-70 (tax invoices); ATO tax invoice guidance",
        "region": "Australia",
        "edition": "current (ATO guidance updated 25 Aug 2025)",
        "checked_on": "2026-09-14"
      },
      {
        "code": "PINT A-NZ Billing BIS",
        "title": "Peppol PINT A-NZ Billing BIS (joint Australia-New Zealand specification)",
        "access": "full_text_verified",
        "clause": "ch 1-2, 5.1",
        "region": "Australia",
        "edition": "1.1.3 (mandatory from 15 Nov 2024)",
        "checked_on": "2026-09-14"
      },
      {
        "code": "Directive 2006/112/EC",
        "title": "Council Directive 2006/112/EC on the common system of VAT",
        "access": "full_text_verified",
        "clause": "Art 226",
        "region": "European Union",
        "edition": "consolidated CELEX 02006L0112-20250101",
        "checked_on": "2026-09-14"
      },
      {
        "code": "EN 16931-1:2017",
        "title": "CEN EN 16931-1 Electronic invoicing - semantic data model",
        "access": "public_summary",
        "region": "European Union",
        "edition": "2017 (withdrawn; 2026 edition published May 2026)",
        "checked_on": "2026-09-14"
      },
      {
        "code": "OC4IDS 0.9.5",
        "title": "Open Contracting for Infrastructure Data Standard",
        "access": "full_text_verified",
        "region": "International",
        "edition": "0.9.5 (site switcher shows 0.9.4)",
        "checked_on": "2026-09-14"
      },
      {
        "code": "OCDS 1.1.5",
        "title": "Open Contracting Data Standard",
        "access": "full_text_verified",
        "region": "International",
        "edition": "1.1 schema, docs 1.1.5",
        "checked_on": "2026-09-14"
      },
      {
        "code": "Peppol BIS Billing 3.0",
        "title": "Peppol BIS Billing 3.0 (CIUS of EN 16931)",
        "access": "full_text_verified",
        "clause": "conformance statement; business requirement groups",
        "region": "International",
        "edition": "3.0.21 (May 2026 release)",
        "checked_on": "2026-09-14"
      },
      {
        "code": "GST Act 1985 (NZ)",
        "title": "Goods and Services Tax Act 1985 (NZ)",
        "access": "public_summary",
        "clause": "taxable supply information (s 19K); IRD guidance",
        "region": "New Zealand",
        "edition": "as amended from 1 Apr 2023",
        "checked_on": "2026-09-14"
      },
      {
        "code": "NZBN Act 2016",
        "title": "New Zealand Business Number Act 2016 - NZBN register",
        "access": "public_summary",
        "region": "New Zealand",
        "edition": "current",
        "checked_on": "2026-09-14"
      },
      {
        "code": "PINT A-NZ Billing BIS",
        "title": "Peppol PINT A-NZ Billing BIS (joint Australia-New Zealand specification)",
        "access": "full_text_verified",
        "clause": "ch 1-2, 5.1",
        "region": "New Zealand",
        "edition": "1.1.3 (mandatory from 15 Nov 2024)",
        "checked_on": "2026-09-14"
      },
      {
        "code": "AIA G702/G703",
        "title": "AIA G702-1992 / G703-1992",
        "access": "public_summary",
        "region": "United States",
        "edition": "1992",
        "checked_on": "2026-09-14"
      },
      {
        "code": "FAR 52.204-7",
        "title": "FAR 52.204-7 System for Award Management (unique entity identifier) (Unique Entity ID, UEI)",
        "access": "full_text_verified",
        "region": "United States",
        "edition": "Nov 2024",
        "checked_on": "2026-09-14"
      }
    ]
  },
  "description": "Job-linked purchase order and invoice lines.",
  "x-demiton-contract-url": "https://docs.demiton.io/registers/purchase_line/",
  "x-demiton-register-catalog": "https://docs.demiton.io/concepts/register-catalog"
}