{
  "process_id": "FA-07",
  "policy_version": "synthetic-v1",
  "event_id": "fa-07-example-v1",
  "input": {
    "entity": "LENDER-1",
    "currency": "USD",
    "cutoff": "2026-10-31T23:59:59Z",
    "window_start": "2026-10-01T00:00:00Z",
    "cohort": [
      {
        "entity": "LENDER-1",
        "currency": "USD",
        "known_at": "2026-10-31T23:59:59Z",
        "loan_id": "L1",
        "allocation_weight": 3
      },
      {
        "entity": "LENDER-1",
        "currency": "USD",
        "known_at": "2026-10-31T23:59:59Z",
        "loan_id": "L2",
        "allocation_weight": 2
      }
    ],
    "lines": [
      {
        "entity": "LENDER-1",
        "currency": "USD",
        "known_at": "2026-10-31T23:59:59Z",
        "source_line_id": "REV1",
        "loan_id": "L1",
        "classification": "revenue",
        "amount_cents": 1400000
      },
      {
        "entity": "LENDER-1",
        "currency": "USD",
        "known_at": "2026-10-31T23:59:59Z",
        "source_line_id": "REV2",
        "loan_id": "L2",
        "classification": "revenue",
        "amount_cents": 1000000
      },
      {
        "entity": "LENDER-1",
        "currency": "USD",
        "known_at": "2026-10-31T23:59:59Z",
        "source_line_id": "REV-U",
        "loan_id": null,
        "classification": "revenue",
        "amount_cents": 100000
      },
      {
        "entity": "LENDER-1",
        "currency": "USD",
        "known_at": "2026-10-31T23:59:59Z",
        "source_line_id": "COST1",
        "loan_id": "L1",
        "classification": "direct_cost",
        "amount_cents": 800000
      },
      {
        "entity": "LENDER-1",
        "currency": "USD",
        "known_at": "2026-10-31T23:59:59Z",
        "source_line_id": "COST2",
        "loan_id": "L2",
        "classification": "direct_cost",
        "amount_cents": 600000
      }
    ],
    "overhead_pool_cents": 400000,
    "accepted_unmatched_ids": [
      "REV-U"
    ],
    "source_revenue_control_cents": 2500000,
    "source_direct_cost_control_cents": 1400000,
    "manifest": {
      "cohort": {
        "as_of": "2026-10-31T23:59:59Z",
        "known_at": "2026-10-31T23:59:59Z",
        "expected_records": 2,
        "received_records": 2,
        "complete": true
      },
      "lines": {
        "as_of": "2026-10-31T23:59:59Z",
        "known_at": "2026-10-31T23:59:59Z",
        "expected_records": 5,
        "received_records": 5,
        "complete": true
      }
    }
  },
  "expected": {
    "status": "ready_for_review_with_open_items",
    "funded_loans": 2,
    "matched_revenue_cents": 2400000,
    "matched_direct_cost_cents": 1400000,
    "allocated_overhead_cents": {
      "L1": 240000,
      "L2": 160000
    },
    "unallocated_overhead_cents": 0,
    "management_profit_cents": 600000,
    "cost_per_funded_loan_cents": 900000,
    "unmatched_revenue_cents": 100000,
    "unmatched_direct_cost_cents": 0,
    "unmatched_source_ids": [
      "REV-U"
    ],
    "errors": []
  },
  "changes": [
    {
      "name": "A repeated commission/direct-cost source line holds",
      "replace_input": {
        "entity": "LENDER-1",
        "currency": "USD",
        "cutoff": "2026-10-31T23:59:59Z",
        "window_start": "2026-10-01T00:00:00Z",
        "cohort": [
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "loan_id": "L1",
            "allocation_weight": 3
          },
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "loan_id": "L2",
            "allocation_weight": 2
          }
        ],
        "lines": [
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "source_line_id": "REV1",
            "loan_id": "L1",
            "classification": "revenue",
            "amount_cents": 1400000
          },
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "source_line_id": "REV2",
            "loan_id": "L2",
            "classification": "revenue",
            "amount_cents": 1000000
          },
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "source_line_id": "REV-U",
            "loan_id": null,
            "classification": "revenue",
            "amount_cents": 100000
          },
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "source_line_id": "COST1",
            "loan_id": "L1",
            "classification": "direct_cost",
            "amount_cents": 800000
          },
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "source_line_id": "COST2",
            "loan_id": "L2",
            "classification": "direct_cost",
            "amount_cents": 600000
          },
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "source_line_id": "COST1",
            "loan_id": "L1",
            "classification": "direct_cost",
            "amount_cents": 800000
          }
        ],
        "overhead_pool_cents": 400000,
        "accepted_unmatched_ids": [
          "REV-U"
        ],
        "source_revenue_control_cents": 2500000,
        "source_direct_cost_control_cents": 1400000,
        "manifest": {
          "cohort": {
            "as_of": "2026-10-31T23:59:59Z",
            "known_at": "2026-10-31T23:59:59Z",
            "expected_records": 2,
            "received_records": 2,
            "complete": true
          },
          "lines": {
            "as_of": "2026-10-31T23:59:59Z",
            "known_at": "2026-10-31T23:59:59Z",
            "expected_records": 6,
            "received_records": 6,
            "complete": true
          }
        }
      },
      "expected": {
        "status": "hold",
        "errors": [
          "invalid_input:source_line_id:duplicate_identifier"
        ]
      }
    },
    {
      "name": "An unmatched amount remains unaccepted",
      "path": [
        "accepted_unmatched_ids"
      ],
      "value": [],
      "expected": {
        "status": "hold",
        "funded_loans": 2,
        "matched_revenue_cents": 2400000,
        "matched_direct_cost_cents": 1400000,
        "allocated_overhead_cents": {
          "L1": 240000,
          "L2": 160000
        },
        "unallocated_overhead_cents": 0,
        "management_profit_cents": 600000,
        "cost_per_funded_loan_cents": 900000,
        "unmatched_revenue_cents": 100000,
        "unmatched_direct_cost_cents": 0,
        "unmatched_source_ids": [
          "REV-U"
        ],
        "errors": [
          "REV-U:unaccepted_unmatched"
        ]
      }
    },
    {
      "name": "Zero weights preserve the unallocated residual",
      "replace_input": {
        "entity": "LENDER-1",
        "currency": "USD",
        "cutoff": "2026-10-31T23:59:59Z",
        "window_start": "2026-10-01T00:00:00Z",
        "cohort": [
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "loan_id": "L1",
            "allocation_weight": 0
          },
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "loan_id": "L2",
            "allocation_weight": 0
          }
        ],
        "lines": [
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "source_line_id": "REV1",
            "loan_id": "L1",
            "classification": "revenue",
            "amount_cents": 1400000
          },
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "source_line_id": "REV2",
            "loan_id": "L2",
            "classification": "revenue",
            "amount_cents": 1000000
          },
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "source_line_id": "REV-U",
            "loan_id": null,
            "classification": "revenue",
            "amount_cents": 100000
          },
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "source_line_id": "COST1",
            "loan_id": "L1",
            "classification": "direct_cost",
            "amount_cents": 800000
          },
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "source_line_id": "COST2",
            "loan_id": "L2",
            "classification": "direct_cost",
            "amount_cents": 600000
          }
        ],
        "overhead_pool_cents": 400000,
        "accepted_unmatched_ids": [
          "REV-U"
        ],
        "source_revenue_control_cents": 2500000,
        "source_direct_cost_control_cents": 1400000,
        "manifest": {
          "cohort": {
            "as_of": "2026-10-31T23:59:59Z",
            "known_at": "2026-10-31T23:59:59Z",
            "expected_records": 2,
            "received_records": 2,
            "complete": true
          },
          "lines": {
            "as_of": "2026-10-31T23:59:59Z",
            "known_at": "2026-10-31T23:59:59Z",
            "expected_records": 5,
            "received_records": 5,
            "complete": true
          }
        }
      },
      "expected": {
        "status": "hold",
        "funded_loans": 2,
        "matched_revenue_cents": 2400000,
        "matched_direct_cost_cents": 1400000,
        "allocated_overhead_cents": {
          "L1": 0,
          "L2": 0
        },
        "unallocated_overhead_cents": 400000,
        "management_profit_cents": 1000000,
        "cost_per_funded_loan_cents": 700000,
        "unmatched_revenue_cents": 100000,
        "unmatched_direct_cost_cents": 0,
        "unmatched_source_ids": [
          "REV-U"
        ],
        "errors": [
          "unallocated_overhead"
        ]
      }
    },
    {
      "name": "A signed negative overhead adjustment conserves cents",
      "path": [
        "overhead_pool_cents"
      ],
      "value": -400001,
      "expected": {
        "status": "ready_for_review_with_open_items",
        "funded_loans": 2,
        "matched_revenue_cents": 2400000,
        "matched_direct_cost_cents": 1400000,
        "allocated_overhead_cents": {
          "L1": -240001,
          "L2": -160000
        },
        "unallocated_overhead_cents": 0,
        "management_profit_cents": 1400001,
        "cost_per_funded_loan_cents": 500000,
        "unmatched_revenue_cents": 100000,
        "unmatched_direct_cost_cents": 0,
        "unmatched_source_ids": [
          "REV-U"
        ],
        "errors": []
      }
    },
    {
      "name": "Unsupported classification is not silently dropped",
      "path": [
        "lines",
        0,
        "classification"
      ],
      "value": "principal_cash",
      "expected": {
        "status": "hold",
        "errors": [
          "invalid_input:classification:unsupported"
        ]
      }
    },
    {
      "name": "Source revenue mismatch remains visible",
      "path": [
        "source_revenue_control_cents"
      ],
      "value": 2500001,
      "expected": {
        "status": "hold",
        "funded_loans": 2,
        "matched_revenue_cents": 2400000,
        "matched_direct_cost_cents": 1400000,
        "allocated_overhead_cents": {
          "L1": 240000,
          "L2": 160000
        },
        "unallocated_overhead_cents": 0,
        "management_profit_cents": 600000,
        "cost_per_funded_loan_cents": 900000,
        "unmatched_revenue_cents": 100000,
        "unmatched_direct_cost_cents": 0,
        "unmatched_source_ids": [
          "REV-U"
        ],
        "errors": [
          "source_revenue_bridge"
        ]
      }
    },
    {
      "name": "Missing source page is an incomplete population",
      "path": [
        "manifest",
        "cohort",
        "received_records"
      ],
      "value": 0,
      "expected": {
        "status": "hold",
        "errors": [
          "invalid_input:cohort:incomplete_population"
        ]
      }
    },
    {
      "name": "Malformed source timestamp holds",
      "path": [
        "manifest",
        "cohort",
        "known_at"
      ],
      "value": "2026-13-32T00:00:00Z",
      "expected": {
        "status": "hold",
        "errors": [
          "invalid_input:cohort.known_at:invalid_utc_timestamp"
        ]
      }
    },
    {
      "name": "Old source as-of cannot satisfy the declared exact cutoff",
      "path": [
        "manifest",
        "cohort",
        "as_of"
      ],
      "value": "2026-10-01T00:00:00Z",
      "expected": {
        "status": "hold",
        "errors": [
          "invalid_input:cohort:invalid_source_cutoff"
        ]
      }
    }
  ]
}
