{
  "title": "Synthetic example: AI-assisted supplier invoice review",
  "notice": "Synthetic data. The trading entities, suppliers, purchase orders, invoices, principals and bank details below are invented. Each candidate proposal and each recorded decision is a fixed fixture value standing in for model output and a person's approval: running ai-invoice-review.mjs makes no model call, contacts no supplier system and pays nobody.",
  "recordedOn": "2026-11-05",
  "grants": {
    "tenant-alpha": {
      "ap-clerk-alpha": {
        "role": "accounts clerk",
        "documents": ["inv-88121"]
      },
      "ap-supervisor-alpha": {
        "role": "accounts payable supervisor",
        "documents": ["inv-88121", "inv-88124"],
        "approvalLimitMinor": 100000
      },
      "ap-team-lead-alpha": {
        "role": "accounts payable team lead",
        "documents": ["inv-88121"],
        "approvalLimitMinor": 100000
      }
    },
    "tenant-beta": {
      "ap-supervisor-beta": {
        "role": "accounts payable supervisor",
        "documents": ["inv-90017"],
        "approvalLimitMinor": 50000
      }
    }
  },
  "documents": {
    "tenant-alpha": {
      "inv-88121": {
        "supplier": {
          "name": "Example Components Ltd",
          "reference": "SUP-EXAMPLE-1"
        },
        "purchaseOrder": {
          "id": "po-4471",
          "currency": "GBP",
          "authorisedNetMinor": 74000,
          "lines": [
            {
              "sku": "EX-220",
              "qty": 40,
              "unitPriceMinor": 1250
            },
            {
              "sku": "EX-331",
              "qty": 10,
              "unitPriceMinor": 2400
            }
          ]
        },
        "invoice": {
          "reference": "EC-88121",
          "currency": "GBP",
          "taxRateBasisPoints": 2000,
          "lines": [
            {
              "sku": "EX-220",
              "qty": 40,
              "unitPriceMinor": 1250,
              "lineTotalMinor": 50000
            },
            {
              "sku": "EX-331",
              "qty": 10,
              "unitPriceMinor": 2600,
              "lineTotalMinor": 26000
            }
          ],
          "netMinor": 76000,
          "taxMinor": 15200,
          "grossMinor": 91200
        },
        "protectedFields": {
          "sortCode": "00-00-00",
          "accountNumber": "00000000",
          "remittanceEmail": "accounts@example-components.invalid",
          "deliveryNote": "Pallet 12 arrived with a damaged seal; photo AP-4471 attached."
        }
      },
      "inv-88124": {
        "supplier": {
          "name": "Example Metals Ltd",
          "reference": "SUP-EXAMPLE-2"
        },
        "purchaseOrder": {
          "id": "po-4488",
          "currency": "GBP",
          "authorisedNetMinor": 75000,
          "lines": [
            {
              "sku": "EX-410",
              "qty": 25,
              "unitPriceMinor": 3000
            }
          ]
        },
        "invoice": {
          "reference": "EM-88124",
          "currency": "GBP",
          "taxRateBasisPoints": 2000,
          "lines": [
            {
              "sku": "EX-410",
              "qty": 25,
              "unitPriceMinor": 3000,
              "lineTotalMinor": 75000
            }
          ],
          "netMinor": 75000,
          "taxMinor": 15000,
          "grossMinor": 90000
        },
        "protectedFields": {
          "sortCode": "00-00-01",
          "accountNumber": "00000001",
          "remittanceEmail": "accounts@example-metals.invalid",
          "deliveryNote": "Two bars of the consignment were rejected on inspection."
        }
      }
    },
    "tenant-beta": {
      "inv-90017": {
        "supplier": {
          "name": "Placeholder Industrial Ltd",
          "reference": "SUP-EXAMPLE-3"
        },
        "purchaseOrder": {
          "id": "po-9001",
          "currency": "GBP",
          "authorisedNetMinor": 30000,
          "lines": [
            {
              "sku": "PL-100",
              "qty": 3,
              "unitPriceMinor": 10000
            }
          ]
        },
        "invoice": {
          "reference": "PI-90017",
          "currency": "GBP",
          "taxRateBasisPoints": 2000,
          "lines": [
            {
              "sku": "PL-100",
              "qty": 3,
              "unitPriceMinor": 10000,
              "lineTotalMinor": 30000
            }
          ],
          "netMinor": 30000,
          "taxMinor": 6000,
          "grossMinor": 36000
        },
        "protectedFields": {
          "sortCode": "00-00-02",
          "accountNumber": "00000002",
          "remittanceEmail": "accounts@placeholder-industrial.invalid",
          "deliveryNote": "Another customer's consignment note; retained by tenant-beta."
        }
      }
    }
  },
  "cases": [
    {
      "id": "approved-variance",
      "title": "Price variance approved by a person with authority",
      "request": {
        "tenant": "tenant-alpha",
        "document": "inv-88121",
        "actor": "ap-clerk-alpha",
        "askedAt": "2026-11-05T09:04:00Z"
      },
      "proposal": {
        "standInFor": "model output, recorded in this fixture",
        "action": "approve_with_variance",
        "amountMinor": 91200,
        "reason": "EX-331 is invoiced at GBP 26.00 against GBP 24.00 on po-4471, which is GBP 20.00 more across 10 units. Goods were received in full, so a person can approve the variance or query it.",
        "cites": ["inv-88121 line EX-331", "po-4471 line EX-331"]
      },
      "decision": {
        "standInFor": "a person's decision, recorded in this fixture",
        "principal": "ap-supervisor-alpha",
        "decision": "approved",
        "document": "inv-88121",
        "amountMinor": 91200,
        "note": "Buyer confirmed the increase in writing. Draft this invoice as billed.",
        "decidedAt": "2026-11-05T09:12:00Z",
        "tenant": "tenant-alpha"
      },
      "expectation": "approved-draft"
    },
    {
      "id": "denied-other-tenant",
      "title": "Supervisor from one entity asks for another entity's invoice",
      "request": {
        "tenant": "tenant-beta",
        "document": "inv-90017",
        "actor": "ap-supervisor-alpha",
        "askedAt": "2026-11-05T09:20:00Z"
      },
      "proposal": {
        "standInFor": "model output, recorded in this fixture",
        "action": "post_invoice",
        "amountMinor": 36000,
        "reason": "Proposal text that must never be shown, because the request is refused before any read."
      },
      "decision": {
        "standInFor": "a person's decision, recorded in this fixture",
        "principal": "ap-supervisor-beta",
        "decision": "approved",
        "document": "inv-90017",
        "amountMinor": 36000,
        "note": "This decision must never be applied: the request is refused first.",
        "decidedAt": "2026-11-05T09:22:00Z",
        "tenant": "tenant-beta"
      },
      "expectation": "denied"
    },
    {
      "id": "denied-unassigned-document",
      "title": "Clerk asks for an invoice outside their queue",
      "request": {
        "tenant": "tenant-alpha",
        "document": "inv-88124",
        "actor": "ap-clerk-alpha",
        "askedAt": "2026-11-05T09:31:00Z"
      },
      "proposal": {
        "standInFor": "model output, recorded in this fixture",
        "action": "post_invoice",
        "amountMinor": 90000,
        "reason": "Proposal text that must never be shown, because the request is refused before any read."
      },
      "decision": {
        "standInFor": "a person's decision, recorded in this fixture",
        "principal": "ap-supervisor-alpha",
        "decision": "approved",
        "document": "inv-88124",
        "amountMinor": 90000,
        "note": "This decision must never be applied: the request is refused first.",
        "decidedAt": "2026-11-05T09:33:00Z",
        "tenant": "tenant-alpha"
      },
      "expectation": "denied"
    },
    {
      "id": "blocked-unknown-approver",
      "title": "Decision signed by somebody the tenant does not know",
      "request": {
        "tenant": "tenant-alpha",
        "document": "inv-88121",
        "actor": "ap-clerk-alpha",
        "askedAt": "2026-11-05T09:38:00Z"
      },
      "proposal": {
        "standInFor": "model output, recorded in this fixture",
        "action": "approve_with_variance",
        "amountMinor": 91200,
        "reason": "The arithmetic agrees and the goods arrived, so this could be drafted if a permitted person approved it."
      },
      "decision": {
        "standInFor": "a person's decision, recorded in this fixture",
        "principal": "ap-director-invented",
        "decision": "approved",
        "document": "inv-88121",
        "amountMinor": 91200,
        "note": "Approval recorded against a principal that exists in no grant.",
        "decidedAt": "2026-11-05T09:41:00Z",
        "tenant": "tenant-alpha"
      },
      "expectation": "blocked"
    },
    {
      "id": "blocked-clerk-cannot-approve",
      "title": "Clerk records their own approval",
      "request": {
        "tenant": "tenant-alpha",
        "document": "inv-88121",
        "actor": "ap-clerk-alpha",
        "askedAt": "2026-11-05T09:44:00Z"
      },
      "proposal": {
        "standInFor": "model output, recorded in this fixture",
        "action": "approve_with_variance",
        "amountMinor": 91200,
        "reason": "The clerk can read this invoice but has no approval authority in the grant."
      },
      "decision": {
        "standInFor": "a person's decision, recorded in this fixture",
        "principal": "ap-clerk-alpha",
        "decision": "approved",
        "document": "inv-88121",
        "amountMinor": 91200,
        "note": "Same person asked the question and recorded the approval.",
        "decidedAt": "2026-11-05T09:46:00Z",
        "tenant": "tenant-alpha"
      },
      "expectation": "blocked"
    },
    {
      "id": "blocked-wrong-document-decision",
      "title": "Decision recorded against a different invoice",
      "request": {
        "tenant": "tenant-alpha",
        "document": "inv-88124",
        "actor": "ap-supervisor-alpha",
        "askedAt": "2026-11-05T09:50:00Z"
      },
      "proposal": {
        "standInFor": "model output, recorded in this fixture",
        "action": "post_invoice",
        "amountMinor": 90000,
        "reason": "Line arithmetic, tax and the purchase order total all agree, so this invoice can be drafted for payment."
      },
      "decision": {
        "standInFor": "a person's decision, recorded in this fixture",
        "principal": "ap-supervisor-alpha",
        "decision": "approved",
        "document": "inv-88121",
        "amountMinor": 90000,
        "note": "An approval carried over from the previous invoice on the same day.",
        "decidedAt": "2026-11-05T09:55:00Z",
        "tenant": "tenant-alpha"
      },
      "expectation": "blocked"
    },
    {
      "id": "blocked-stale-amount",
      "title": "Decision approving an amount the invoice does not carry",
      "request": {
        "tenant": "tenant-alpha",
        "document": "inv-88124",
        "actor": "ap-supervisor-alpha",
        "askedAt": "2026-11-05T10:00:00Z"
      },
      "proposal": {
        "standInFor": "model output, recorded in this fixture",
        "action": "post_invoice",
        "amountMinor": 90000,
        "reason": "Line arithmetic, tax and the purchase order total all agree, so this invoice can be drafted for payment."
      },
      "decision": {
        "standInFor": "a person's decision, recorded in this fixture",
        "principal": "ap-supervisor-alpha",
        "decision": "approved",
        "document": "inv-88124",
        "amountMinor": 1,
        "note": "Amount recorded before the invoice was re-read; it no longer matches the total.",
        "decidedAt": "2026-11-05T10:02:00Z",
        "tenant": "tenant-alpha"
      },
      "expectation": "blocked"
    },
    {
      "id": "blocked-approver-outside-document-scope",
      "title": "Approver records a decision outside their own document scope",
      "request": {
        "tenant": "tenant-alpha",
        "document": "inv-88124",
        "actor": "ap-supervisor-alpha",
        "askedAt": "2026-11-05T09:58:00Z"
      },
      "proposal": {
        "standInFor": "model output, recorded in this fixture",
        "action": "post_invoice",
        "amountMinor": 90000,
        "reason": "Line arithmetic, tax and the purchase order total all agree, so this invoice can be drafted for payment."
      },
      "decision": {
        "standInFor": "a person's decision, recorded in this fixture",
        "principal": "ap-team-lead-alpha",
        "tenant": "tenant-alpha",
        "decision": "approved",
        "document": "inv-88124",
        "amountMinor": 90000,
        "note": "Team lead holds approval authority but this invoice is not in their queue.",
        "decidedAt": "2026-11-05T09:59:00Z"
      },
      "expectation": "blocked"
    },
    {
      "id": "blocked-cross-tenant-decision",
      "title": "Decision recorded in another tenant is replayed",
      "request": {
        "tenant": "tenant-alpha",
        "document": "inv-88121",
        "actor": "ap-clerk-alpha",
        "askedAt": "2026-11-05T09:56:00Z"
      },
      "proposal": {
        "standInFor": "model output, recorded in this fixture",
        "action": "approve_with_variance",
        "amountMinor": 91200,
        "reason": "The arithmetic agrees and the goods arrived, so this could be drafted if a permitted person approved it."
      },
      "decision": {
        "standInFor": "a person's decision, recorded in this fixture",
        "principal": "ap-supervisor-alpha",
        "tenant": "tenant-beta",
        "decision": "approved",
        "document": "inv-88121",
        "amountMinor": 91200,
        "note": "Approval copied from another entity's record with the same invoice number.",
        "decidedAt": "2026-11-05T09:57:00Z"
      },
      "expectation": "blocked"
    },
    {
      "id": "blocked-wrong-amount",
      "title": "Proposal states an amount the invoice does not support",
      "request": {
        "tenant": "tenant-alpha",
        "document": "inv-88124",
        "actor": "ap-supervisor-alpha",
        "askedAt": "2026-11-05T10:05:00Z"
      },
      "proposal": {
        "standInFor": "model output, recorded in this fixture",
        "action": "post_invoice",
        "amountMinor": 88600,
        "reason": "The invoice is ready to post at GBP 886.00 against purchase order po-4488.",
        "cites": ["inv-88124 total"]
      },
      "decision": {
        "standInFor": "a person's decision, recorded in this fixture",
        "principal": "ap-supervisor-alpha",
        "decision": "approved",
        "document": "inv-88124",
        "amountMinor": 90000,
        "note": "Reviewer approved the invoice total without reading the proposal figure.",
        "decidedAt": "2026-11-05T10:12:00Z",
        "tenant": "tenant-alpha"
      },
      "expectation": "blocked"
    },
    {
      "id": "rejected-by-human",
      "title": "Valid proposal, refused by the reviewer",
      "request": {
        "tenant": "tenant-alpha",
        "document": "inv-88124",
        "actor": "ap-supervisor-alpha",
        "askedAt": "2026-11-05T10:15:00Z"
      },
      "proposal": {
        "standInFor": "model output, recorded in this fixture",
        "action": "post_invoice",
        "amountMinor": 90000,
        "reason": "Line arithmetic, tax and the purchase order total all agree, so the invoice can be drafted for payment."
      },
      "decision": {
        "standInFor": "a person's decision, recorded in this fixture",
        "principal": "ap-supervisor-alpha",
        "decision": "rejected",
        "document": "inv-88124",
        "amountMinor": 90000,
        "note": "Rejected bars were signed for by the warehouse. Query the supplier before this goes anywhere.",
        "decidedAt": "2026-11-05T10:24:00Z",
        "tenant": "tenant-alpha"
      },
      "expectation": "rejected"
    }
  ]
}
