{
  "process_id": "TR-01",
  "policy_version": "synthetic-v1",
  "event_id": "tr-01-example-v1",
  "input": {
    "cutoff": "2026-11-09T08:00:00Z",
    "entity_id": "LENDER",
    "currency": "USD",
    "contract_version": "illustrative-2026-11-v1",
    "sources": [
      {
        "source_id": "account_perimeter",
        "as_of": "2026-11-09T08:00:00Z",
        "received_at": "2026-11-09T08:00:00Z",
        "complete": true,
        "revision": "v1"
      },
      {
        "source_id": "bank",
        "as_of": "2026-11-09T08:00:00Z",
        "received_at": "2026-11-09T08:00:00Z",
        "complete": true,
        "revision": "v1"
      },
      {
        "source_id": "cash_ledger",
        "as_of": "2026-11-09T08:00:00Z",
        "received_at": "2026-11-09T08:00:00Z",
        "complete": true,
        "revision": "v1"
      }
    ],
    "expected_account_ids": [
      "OPERATING",
      "ESCROW"
    ],
    "accounts": [
      {
        "account_id": "OPERATING",
        "entity_id": "LENDER",
        "currency": "USD",
        "classification": "unrestricted",
        "bank_cents": 100000000,
        "reconciling_items_cents": -100000,
        "ledger_cents": 99900000,
        "known_at": "2026-11-09T08:00:00Z"
      },
      {
        "account_id": "ESCROW",
        "entity_id": "LENDER",
        "currency": "USD",
        "classification": "escrow",
        "bank_cents": 50000000,
        "reconciling_items_cents": 0,
        "ledger_cents": 50000000,
        "known_at": "2026-11-09T08:00:00Z"
      }
    ]
  },
  "expected": {
    "status": "opening_basis_for_review",
    "cash_basis": "ledger_adjusted_bank_reconciled",
    "unrestricted_cash_cents": 99900000,
    "restricted_cents": 0,
    "escrow_cents": 50000000,
    "total_ledger_cash_cents": 149900000,
    "duplicate_rows": 0,
    "breaks": []
  },
  "changes": [
    {
      "name": "One-dollar opening difference",
      "path": [
        "accounts",
        0,
        "ledger_cents"
      ],
      "value": 99899900,
      "expected": {
        "status": "hold",
        "cash_basis": "ledger_adjusted_bank_reconciled",
        "unrestricted_cash_cents": 99899900,
        "restricted_cents": 0,
        "escrow_cents": 50000000,
        "total_ledger_cash_cents": 149899900,
        "duplicate_rows": 0,
        "breaks": [
          {
            "account_id": "OPERATING",
            "difference_cents": 100
          }
        ]
      }
    },
    {
      "name": "Escrow increase does not create operating cash",
      "replace_input": {
        "cutoff": "2026-11-09T08:00:00Z",
        "entity_id": "LENDER",
        "currency": "USD",
        "contract_version": "illustrative-2026-11-v1",
        "sources": [
          {
            "source_id": "account_perimeter",
            "as_of": "2026-11-09T08:00:00Z",
            "received_at": "2026-11-09T08:00:00Z",
            "complete": true,
            "revision": "v1"
          },
          {
            "source_id": "bank",
            "as_of": "2026-11-09T08:00:00Z",
            "received_at": "2026-11-09T08:00:00Z",
            "complete": true,
            "revision": "v1"
          },
          {
            "source_id": "cash_ledger",
            "as_of": "2026-11-09T08:00:00Z",
            "received_at": "2026-11-09T08:00:00Z",
            "complete": true,
            "revision": "v1"
          }
        ],
        "expected_account_ids": [
          "OPERATING",
          "ESCROW"
        ],
        "accounts": [
          {
            "account_id": "OPERATING",
            "entity_id": "LENDER",
            "currency": "USD",
            "classification": "unrestricted",
            "bank_cents": 100000000,
            "reconciling_items_cents": -100000,
            "ledger_cents": 99900000,
            "known_at": "2026-11-09T08:00:00Z"
          },
          {
            "account_id": "ESCROW",
            "entity_id": "LENDER",
            "currency": "USD",
            "classification": "escrow",
            "bank_cents": 60000000,
            "reconciling_items_cents": 0,
            "ledger_cents": 60000000,
            "known_at": "2026-11-09T08:00:00Z"
          }
        ]
      },
      "expected": {
        "status": "opening_basis_for_review",
        "cash_basis": "ledger_adjusted_bank_reconciled",
        "unrestricted_cash_cents": 99900000,
        "restricted_cents": 0,
        "escrow_cents": 60000000,
        "total_ledger_cash_cents": 159900000,
        "duplicate_rows": 0,
        "breaks": []
      }
    },
    {
      "name": "Missing expected account",
      "path": [
        "accounts"
      ],
      "value": [
        {
          "account_id": "OPERATING",
          "entity_id": "LENDER",
          "currency": "USD",
          "classification": "unrestricted",
          "bank_cents": 100000000,
          "reconciling_items_cents": -100000,
          "ledger_cents": 99900000,
          "known_at": "2026-11-09T08:00:00Z"
        }
      ],
      "expected": {
        "status": "hold",
        "errors": [
          "invalid_input:account_perimeter_mismatch"
        ]
      }
    },
    {
      "name": "Malformed money rejected",
      "path": [
        "accounts",
        0,
        "bank_cents"
      ],
      "value": true,
      "expected": {
        "status": "hold",
        "errors": [
          "invalid_input:bank_cents:integer_out_of_contract"
        ]
      }
    },
    {
      "name": "Identical bank row replay",
      "append_path": [
        "accounts"
      ],
      "append_value": {
        "account_id": "OPERATING",
        "entity_id": "LENDER",
        "currency": "USD",
        "classification": "unrestricted",
        "bank_cents": 100000000,
        "reconciling_items_cents": -100000,
        "ledger_cents": 99900000,
        "known_at": "2026-11-09T08:00:00Z"
      },
      "expected": {
        "status": "opening_basis_for_review",
        "cash_basis": "ledger_adjusted_bank_reconciled",
        "unrestricted_cash_cents": 99900000,
        "restricted_cents": 0,
        "escrow_cents": 50000000,
        "total_ledger_cash_cents": 149900000,
        "duplicate_rows": 1,
        "breaks": []
      }
    },
    {
      "name": "Stale bank source",
      "path": [
        "sources",
        1,
        "as_of"
      ],
      "value": "2026-11-08T08:00:00Z",
      "expected": {
        "status": "hold",
        "errors": [
          "invalid_input:source_cutoff_mismatch:bank"
        ]
      }
    },
    {
      "name": "Mixed-currency perimeter",
      "path": [
        "accounts",
        1,
        "currency"
      ],
      "value": "EUR",
      "expected": {
        "status": "hold",
        "errors": [
          "invalid_input:mixed_currency"
        ]
      }
    },
    {
      "name": "Wrong legal entity held",
      "path": [
        "accounts",
        0,
        "entity_id"
      ],
      "value": "OTHER-LENDER",
      "expected": {
        "status": "hold",
        "errors": [
          "invalid_input:wrong_entity"
        ]
      }
    }
  ]
}
