{
  "process_id": "FA-04",
  "policy_version": "synthetic-v1",
  "event_id": "fa-04-example-v1",
  "input": {
    "entity": "LENDER-1",
    "currency": "USD",
    "cutoff": "2026-10-31T23:59:59Z",
    "window_start": "2026-10-01T00:00:00Z",
    "facilities": [
      {
        "entity": "LENDER-1",
        "currency": "USD",
        "known_at": "2026-10-31T23:59:59Z",
        "facility_id": "WH1",
        "opening_cents": 100000000,
        "draw_cents": 30000000,
        "repayment_cents": 20000000,
        "closing_cents": 110000000,
        "gl_closing_cents": 110000000,
        "booked_interest_cents": 53333,
        "day_count": 360
      }
    ],
    "daily_balances": [
      {
        "entity": "LENDER-1",
        "currency": "USD",
        "known_at": "2026-10-31T23:59:59Z",
        "facility_id": "WH1",
        "date": "2026-10-29",
        "balance_cents": 100000000,
        "annual_rate_bps": 600
      },
      {
        "entity": "LENDER-1",
        "currency": "USD",
        "known_at": "2026-10-31T23:59:59Z",
        "facility_id": "WH1",
        "date": "2026-10-30",
        "balance_cents": 110000000,
        "annual_rate_bps": 600
      },
      {
        "entity": "LENDER-1",
        "currency": "USD",
        "known_at": "2026-10-31T23:59:59Z",
        "facility_id": "WH1",
        "date": "2026-10-31",
        "balance_cents": 110000000,
        "annual_rate_bps": 600
      }
    ],
    "bank_movements": [
      {
        "entity": "LENDER-1",
        "currency": "USD",
        "known_at": "2026-10-31T23:59:59Z",
        "transaction_id": "B1",
        "facility_id": "WH1",
        "kind": "draw",
        "value_date": "2026-10-30",
        "amount_cents": 30000000
      },
      {
        "entity": "LENDER-1",
        "currency": "USD",
        "known_at": "2026-10-31T23:59:59Z",
        "transaction_id": "B2",
        "facility_id": "WH1",
        "kind": "repayment",
        "value_date": "2026-10-30",
        "amount_cents": 20000000
      }
    ],
    "required_facilities": [
      "WH1"
    ],
    "period_start": "2026-10-29",
    "period_end": "2026-10-31",
    "manifest": {
      "facilities": {
        "as_of": "2026-10-31T23:59:59Z",
        "known_at": "2026-10-31T23:59:59Z",
        "expected_records": 1,
        "received_records": 1,
        "complete": true
      },
      "daily_balances": {
        "as_of": "2026-10-31T23:59:59Z",
        "known_at": "2026-10-31T23:59:59Z",
        "expected_records": 3,
        "received_records": 3,
        "complete": true
      },
      "bank_movements": {
        "as_of": "2026-10-31T23:59:59Z",
        "known_at": "2026-10-31T23:59:59Z",
        "expected_records": 2,
        "received_records": 2,
        "complete": true
      }
    }
  },
  "expected": {
    "status": "ready_for_review",
    "facilities": [
      {
        "facility_id": "WH1",
        "derived_closing_cents": 110000000,
        "carry_cents": 53333,
        "interest_variance_cents": 0
      }
    ],
    "errors": []
  },
  "changes": [
    {
      "name": "Different ending GL principal remains a break",
      "path": [
        "facilities",
        0,
        "gl_closing_cents"
      ],
      "value": 109999900,
      "expected": {
        "status": "hold",
        "facilities": [
          {
            "facility_id": "WH1",
            "derived_closing_cents": 110000000,
            "carry_cents": 53333,
            "interest_variance_cents": 0
          }
        ],
        "errors": [
          "WH1:principal_bridge"
        ]
      }
    },
    {
      "name": "A changed dated rate creates an interest variance",
      "path": [
        "daily_balances",
        2,
        "annual_rate_bps"
      ],
      "value": 650,
      "expected": {
        "status": "hold",
        "facilities": [
          {
            "facility_id": "WH1",
            "derived_closing_cents": 110000000,
            "carry_cents": 54861,
            "interest_variance_cents": 1528
          }
        ],
        "errors": [
          "WH1:interest_bridge"
        ]
      }
    },
    {
      "name": "Missing day cannot create a complete carry calculation",
      "replace_input": {
        "entity": "LENDER-1",
        "currency": "USD",
        "cutoff": "2026-10-31T23:59:59Z",
        "window_start": "2026-10-01T00:00:00Z",
        "facilities": [
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "facility_id": "WH1",
            "opening_cents": 100000000,
            "draw_cents": 30000000,
            "repayment_cents": 20000000,
            "closing_cents": 110000000,
            "gl_closing_cents": 110000000,
            "booked_interest_cents": 53333,
            "day_count": 360
          }
        ],
        "daily_balances": [
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "facility_id": "WH1",
            "date": "2026-10-29",
            "balance_cents": 100000000,
            "annual_rate_bps": 600
          },
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "facility_id": "WH1",
            "date": "2026-10-31",
            "balance_cents": 110000000,
            "annual_rate_bps": 600
          }
        ],
        "bank_movements": [
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "transaction_id": "B1",
            "facility_id": "WH1",
            "kind": "draw",
            "value_date": "2026-10-30",
            "amount_cents": 30000000
          },
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "transaction_id": "B2",
            "facility_id": "WH1",
            "kind": "repayment",
            "value_date": "2026-10-30",
            "amount_cents": 20000000
          }
        ],
        "required_facilities": [
          "WH1"
        ],
        "period_start": "2026-10-29",
        "period_end": "2026-10-31",
        "manifest": {
          "facilities": {
            "as_of": "2026-10-31T23:59:59Z",
            "known_at": "2026-10-31T23:59:59Z",
            "expected_records": 1,
            "received_records": 1,
            "complete": true
          },
          "daily_balances": {
            "as_of": "2026-10-31T23:59:59Z",
            "known_at": "2026-10-31T23:59:59Z",
            "expected_records": 2,
            "received_records": 2,
            "complete": true
          },
          "bank_movements": {
            "as_of": "2026-10-31T23:59:59Z",
            "known_at": "2026-10-31T23:59:59Z",
            "expected_records": 2,
            "received_records": 2,
            "complete": true
          }
        }
      },
      "expected": {
        "status": "hold",
        "errors": [
          "invalid_input:daily_balances:incomplete_date_coverage"
        ]
      }
    },
    {
      "name": "Omitted inactive facility cannot pass the registered population",
      "path": [
        "required_facilities"
      ],
      "value": [
        "WH1",
        "WH2"
      ],
      "expected": {
        "status": "hold",
        "errors": [
          "invalid_input:facilities:incomplete_register"
        ]
      }
    },
    {
      "name": "Duplicate bank transaction cannot double-count",
      "replace_input": {
        "entity": "LENDER-1",
        "currency": "USD",
        "cutoff": "2026-10-31T23:59:59Z",
        "window_start": "2026-10-01T00:00:00Z",
        "facilities": [
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "facility_id": "WH1",
            "opening_cents": 100000000,
            "draw_cents": 30000000,
            "repayment_cents": 20000000,
            "closing_cents": 110000000,
            "gl_closing_cents": 110000000,
            "booked_interest_cents": 53333,
            "day_count": 360
          }
        ],
        "daily_balances": [
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "facility_id": "WH1",
            "date": "2026-10-29",
            "balance_cents": 100000000,
            "annual_rate_bps": 600
          },
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "facility_id": "WH1",
            "date": "2026-10-30",
            "balance_cents": 110000000,
            "annual_rate_bps": 600
          },
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "facility_id": "WH1",
            "date": "2026-10-31",
            "balance_cents": 110000000,
            "annual_rate_bps": 600
          }
        ],
        "bank_movements": [
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "transaction_id": "B1",
            "facility_id": "WH1",
            "kind": "draw",
            "value_date": "2026-10-30",
            "amount_cents": 30000000
          },
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "transaction_id": "B2",
            "facility_id": "WH1",
            "kind": "repayment",
            "value_date": "2026-10-30",
            "amount_cents": 20000000
          },
          {
            "entity": "LENDER-1",
            "currency": "USD",
            "known_at": "2026-10-31T23:59:59Z",
            "transaction_id": "B1",
            "facility_id": "WH1",
            "kind": "draw",
            "value_date": "2026-10-30",
            "amount_cents": 30000000
          }
        ],
        "required_facilities": [
          "WH1"
        ],
        "period_start": "2026-10-29",
        "period_end": "2026-10-31",
        "manifest": {
          "facilities": {
            "as_of": "2026-10-31T23:59:59Z",
            "known_at": "2026-10-31T23:59:59Z",
            "expected_records": 1,
            "received_records": 1,
            "complete": true
          },
          "daily_balances": {
            "as_of": "2026-10-31T23:59:59Z",
            "known_at": "2026-10-31T23:59:59Z",
            "expected_records": 3,
            "received_records": 3,
            "complete": true
          },
          "bank_movements": {
            "as_of": "2026-10-31T23:59:59Z",
            "known_at": "2026-10-31T23:59:59Z",
            "expected_records": 3,
            "received_records": 3,
            "complete": true
          }
        }
      },
      "expected": {
        "status": "hold",
        "errors": [
          "invalid_input:transaction_id:duplicate_identifier"
        ]
      }
    },
    {
      "name": "Unknown movement kind holds",
      "path": [
        "bank_movements",
        0,
        "kind"
      ],
      "value": "fee",
      "expected": {
        "status": "hold",
        "errors": [
          "invalid_input:bank:unsupported_movement_kind"
        ]
      }
    },
    {
      "name": "Missing source page is an incomplete population",
      "path": [
        "manifest",
        "facilities",
        "received_records"
      ],
      "value": 0,
      "expected": {
        "status": "hold",
        "errors": [
          "invalid_input:facilities:incomplete_population"
        ]
      }
    },
    {
      "name": "Malformed source timestamp holds",
      "path": [
        "manifest",
        "facilities",
        "known_at"
      ],
      "value": "2026-13-32T00:00:00Z",
      "expected": {
        "status": "hold",
        "errors": [
          "invalid_input:facilities.known_at:invalid_utc_timestamp"
        ]
      }
    },
    {
      "name": "Old source as-of cannot satisfy the declared exact cutoff",
      "path": [
        "manifest",
        "facilities",
        "as_of"
      ],
      "value": "2026-10-01T00:00:00Z",
      "expected": {
        "status": "hold",
        "errors": [
          "invalid_input:facilities:invalid_source_cutoff"
        ]
      }
    }
  ]
}
