{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "Candidate report contract. Monetary values are exact USD amounts, not USD millions. Financial assertions use exact public panel citations. Institutional conclusions require source-entailing premises; supported alternatives are accepted without exact prose matching.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "episode_id",
    "rates",
    "credit_xva",
    "capital",
    "liquidity",
    "legal",
    "compliance",
    "structure",
    "recommendation",
    "accounting"
  ],
  "properties": {
    "legal": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "findings"
      ],
      "properties": {
        "findings": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "subject_id",
              "status",
              "premises",
              "rationale"
            ],
            "properties": {
              "subject_id": {
                "type": "string",
                "minLength": 1,
                "pattern": "\\S"
              },
              "status": {
                "enum": [
                  "permitted",
                  "conditional",
                  "blocked"
                ]
              },
              "premises": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "source",
                    "pointer",
                    "relation",
                    "value"
                  ],
                  "properties": {
                    "source": {
                      "enum": [
                        "case",
                        "state",
                        "book",
                        "report"
                      ]
                    },
                    "pointer": {
                      "type": "string",
                      "pattern": "^(?:/(?:[^~/]|~[01])*)*(?![\\s\\S])"
                    },
                    "relation": {
                      "enum": [
                        "eq",
                        "ne",
                        "gte",
                        "lte",
                        "contains"
                      ]
                    },
                    "value": {
                      "anyOf": [
                        {
                          "type": [
                            "string",
                            "integer",
                            "boolean",
                            "null"
                          ]
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": [
                              "string",
                              "integer",
                              "boolean",
                              "null"
                            ]
                          }
                        }
                      ]
                    }
                  }
                }
              },
              "rationale": {
                "type": "string",
                "minLength": 1,
                "pattern": "\\S"
              }
            }
          }
        }
      }
    },
    "compliance": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "decisions"
      ],
      "properties": {
        "decisions": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "rule_id",
              "decision",
              "premises",
              "rationale"
            ],
            "properties": {
              "rule_id": {
                "type": "string",
                "minLength": 1,
                "pattern": "\\S"
              },
              "decision": {
                "enum": [
                  "execute",
                  "escalate",
                  "decline",
                  "await_approval"
                ]
              },
              "premises": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "source",
                    "pointer",
                    "relation",
                    "value"
                  ],
                  "properties": {
                    "source": {
                      "enum": [
                        "case",
                        "state",
                        "book",
                        "report"
                      ]
                    },
                    "pointer": {
                      "type": "string",
                      "pattern": "^(?:/(?:[^~/]|~[01])*)*(?![\\s\\S])"
                    },
                    "relation": {
                      "enum": [
                        "eq",
                        "ne",
                        "gte",
                        "lte",
                        "contains"
                      ]
                    },
                    "value": {
                      "anyOf": [
                        {
                          "type": [
                            "string",
                            "integer",
                            "boolean",
                            "null"
                          ]
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": [
                              "string",
                              "integer",
                              "boolean",
                              "null"
                            ]
                          }
                        }
                      ]
                    }
                  }
                }
              },
              "rationale": {
                "type": "string",
                "minLength": 1,
                "pattern": "\\S"
              }
            }
          }
        }
      }
    },
    "structure": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "party_id",
        "legal_form",
        "client_executable",
        "classification",
        "cash_required",
        "cash_delivered",
        "deadline_met",
        "bank_viable",
        "premises",
        "rationale"
      ],
      "properties": {
        "party_id": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "legal_form": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "client_executable": {
          "type": "boolean"
        },
        "classification": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "cash_required": {
          "type": "string",
          "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?![\\s\\S])",
          "x-exact-decimal": true,
          "x-dimension": "money"
        },
        "cash_delivered": {
          "type": "string",
          "pattern": "^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?![\\s\\S])",
          "x-exact-decimal": true,
          "x-dimension": "money"
        },
        "deadline_met": {
          "type": "boolean"
        },
        "bank_viable": {
          "type": "boolean"
        },
        "premises": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "source",
              "pointer",
              "relation",
              "value"
            ],
            "properties": {
              "source": {
                "enum": [
                  "case",
                  "state",
                  "book",
                  "report"
                ]
              },
              "pointer": {
                "type": "string",
                "pattern": "^(?:/(?:[^~/]|~[01])*)*(?![\\s\\S])"
              },
              "relation": {
                "enum": [
                  "eq",
                  "ne",
                  "gte",
                  "lte",
                  "contains"
                ]
              },
              "value": {
                "anyOf": [
                  {
                    "type": [
                      "string",
                      "integer",
                      "boolean",
                      "null"
                    ]
                  },
                  {
                    "type": "array",
                    "items": {
                      "type": [
                        "string",
                        "integer",
                        "boolean",
                        "null"
                      ]
                    }
                  }
                ]
              }
            }
          }
        },
        "rationale": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        }
      }
    },
    "recommendation": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "action_kind",
        "subject_id",
        "binding_constraint",
        "position_id",
        "premises",
        "alternatives",
        "rationale"
      ],
      "properties": {
        "action_kind": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "subject_id": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "binding_constraint": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        },
        "position_id": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1
        },
        "premises": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "source",
              "pointer",
              "relation",
              "value"
            ],
            "properties": {
              "source": {
                "enum": [
                  "case",
                  "state",
                  "book",
                  "report"
                ]
              },
              "pointer": {
                "type": "string",
                "pattern": "^(?:/(?:[^~/]|~[01])*)*(?![\\s\\S])"
              },
              "relation": {
                "enum": [
                  "eq",
                  "ne",
                  "gte",
                  "lte",
                  "contains"
                ]
              },
              "value": {
                "anyOf": [
                  {
                    "type": [
                      "string",
                      "integer",
                      "boolean",
                      "null"
                    ]
                  },
                  {
                    "type": "array",
                    "items": {
                      "type": [
                        "string",
                        "integer",
                        "boolean",
                        "null"
                      ]
                    }
                  }
                ]
              }
            }
          }
        },
        "alternatives": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "action_kind",
              "subject_id",
              "reason",
              "premises"
            ],
            "properties": {
              "action_kind": {
                "type": "string",
                "minLength": 1,
                "pattern": "\\S"
              },
              "subject_id": {
                "type": "string",
                "minLength": 1,
                "pattern": "\\S"
              },
              "reason": {
                "type": "string",
                "minLength": 1,
                "pattern": "\\S"
              },
              "premises": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "source",
                    "pointer",
                    "relation",
                    "value"
                  ],
                  "properties": {
                    "source": {
                      "enum": [
                        "case",
                        "state",
                        "book",
                        "report"
                      ]
                    },
                    "pointer": {
                      "type": "string",
                      "pattern": "^(?:/(?:[^~/]|~[01])*)*(?![\\s\\S])"
                    },
                    "relation": {
                      "enum": [
                        "eq",
                        "ne",
                        "gte",
                        "lte",
                        "contains"
                      ]
                    },
                    "value": {
                      "anyOf": [
                        {
                          "type": [
                            "string",
                            "integer",
                            "boolean",
                            "null"
                          ]
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": [
                              "string",
                              "integer",
                              "boolean",
                              "null"
                            ]
                          }
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "rationale": {
          "type": "string",
          "minLength": 1,
          "pattern": "\\S"
        }
      }
    },
    "schema_version": {
      "type": "string",
      "const": "back_to_back_funding_book.v1r2"
    },
    "episode_id": {
      "type": "string",
      "minLength": 1
    },
    "rates": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "total_return_role",
        "financing_role",
        "principal_cash_source",
        "funding_component",
        "reference_adjustment",
        "legal_value",
        "positive_exposure",
        "funding_dv01",
        "deployment_funding_dv01",
        "mismatch_dv01",
        "funding_remaining_at_year5",
        "mark_quote_basis",
        "year5_reinvestment",
        "evidence"
      ],
      "properties": {
        "total_return_role": {
          "type": "string",
          "enum": ["receiver", "payer"]
        },
        "financing_role": {
          "type": "string",
          "enum": ["payer", "receiver"]
        },
        "principal_cash_source": {
          "type": "string",
          "enum": ["identified_asset_sale", "unfunded_swap"]
        },
        "funding_component": {"$ref": "#/$defs/decimal"},
        "reference_adjustment": {"$ref": "#/$defs/decimal"},
        "legal_value": {"$ref": "#/$defs/decimal"},
        "positive_exposure": {"$ref": "#/$defs/decimal"},
        "funding_dv01": {"$ref": "#/$defs/decimal"},
        "deployment_funding_dv01": {"$ref": "#/$defs/decimal"},
        "mismatch_dv01": {"$ref": "#/$defs/decimal"},
        "funding_remaining_at_year5": {
          "$ref": "#/$defs/decimal",
          "description": "Remaining funding tenor in years."
        },
        "mark_quote_basis": {
          "type": "string",
          "enum": ["reset_to_today", "original_reference"]
        },
        "year5_reinvestment": {
          "type": "string",
          "enum": ["OIS_cash", "new_locked_EM"]
        },
        "evidence": {"$ref": "#/$defs/evidence"}
      }
    },
    "credit_xva": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "accounting_cva",
        "actual_ufva",
        "mark_only_ufva",
        "conditional_quadratic_ufva",
        "own_funding_curve",
        "basis_spread",
        "noncash_charge_creates_borrowing",
        "use_cash_vm",
        "provider_default_exposure_source",
        "conditional_quadratic_requires_cash_transaction",
        "evidence"
      ],
      "properties": {
        "accounting_cva": {"$ref": "#/$defs/decimal"},
        "actual_ufva": {"$ref": "#/$defs/decimal"},
        "mark_only_ufva": {"$ref": "#/$defs/decimal"},
        "conditional_quadratic_ufva": {"$ref": "#/$defs/decimal"},
        "own_funding_curve": {
          "type": "string",
          "enum": ["own_unsecured_bond", "own_CDS", "provider_CDS", "internal_AAA"]
        },
        "basis_spread": {"$ref": "#/$defs/decimal"},
        "noncash_charge_creates_borrowing": {"type": "boolean"},
        "use_cash_vm": {"type": "boolean"},
        "provider_default_exposure_source": {
          "type": "string",
          "enum": ["contract_mark", "supplied_path"]
        },
        "conditional_quadratic_requires_cash_transaction": {"type": "boolean"},
        "evidence": {"$ref": "#/$defs/evidence"}
      }
    },
    "capital": {
      "type": "object",
      "additionalProperties": false,
      "required": ["saccr", "collateral", "protection", "capacity", "allocation", "evidence"],
      "properties": {
        "saccr": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "RC",
            "PFE",
            "EAD",
            "MF",
            "supervisory_duration",
            "reference_sf",
            "provider_rw",
            "primary_class",
            "reference_asset_is_held_C"
          ],
          "properties": {
            "RC": {"$ref": "#/$defs/decimal"},
            "PFE": {"$ref": "#/$defs/decimal"},
            "EAD": {"$ref": "#/$defs/decimal"},
            "MF": {"$ref": "#/$defs/decimal"},
            "supervisory_duration": {"$ref": "#/$defs/decimal"},
            "reference_sf": {"$ref": "#/$defs/decimal"},
            "provider_rw": {"$ref": "#/$defs/decimal"},
            "primary_class": {
              "type": "string",
              "enum": ["credit", "interest_rate", "both"]
            },
            "reference_asset_is_held_C": {"type": "boolean"}
          }
        },
        "collateral": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "eligible",
            "recognised",
            "E_star",
            "RWA",
            "capital",
            "KVA",
            "charge_spread",
            "eligibility_reason",
            "rating_drives_eligibility_not_spread"
          ],
          "properties": {
            "eligible": {"type": "boolean"},
            "recognised": {"$ref": "#/$defs/decimal"},
            "E_star": {"$ref": "#/$defs/decimal"},
            "RWA": {"$ref": "#/$defs/decimal"},
            "capital": {"$ref": "#/$defs/decimal"},
            "KVA": {"$ref": "#/$defs/decimal"},
            "charge_spread": {"$ref": "#/$defs/decimal"},
            "eligibility_reason": {
              "type": "string",
              "enum": ["eligible", "same_issuer", "rating_below_threshold", "nonsecurity", "missing_rights", "illiquid"]
            },
            "rating_drives_eligibility_not_spread": {"type": "boolean"}
          }
        },
        "protection": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "Pa_initial",
            "Pa_year1",
            "Pa_year475",
            "tail_years",
            "full_initial_maturity_recognition",
            "economically_protected_tail",
            "cva_capital",
            "ccr_capital",
            "cva_designated",
            "cva_approach",
            "leverage_notional_offset"
          ],
          "properties": {
            "Pa_initial": {"$ref": "#/$defs/decimal"},
            "Pa_year1": {"$ref": "#/$defs/decimal"},
            "Pa_year475": {"$ref": "#/$defs/decimal"},
            "tail_years": {"$ref": "#/$defs/decimal"},
            "full_initial_maturity_recognition": {"type": "boolean"},
            "economically_protected_tail": {"type": "boolean"},
            "cva_capital": {"$ref": "#/$defs/decimal"},
            "ccr_capital": {"$ref": "#/$defs/decimal"},
            "cva_designated": {"type": "boolean"},
            "cva_approach": {
              "type": "string",
              "enum": ["BA_reduced", "BA_full", "SA_approved"]
            },
            "leverage_notional_offset": {"type": "boolean"}
          }
        },
        "capacity": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "leverage_exposure",
            "leverage_required",
            "Tier1",
            "capital_KVA",
            "structural_value",
            "capital_cash_credit",
            "binding",
            "chosen_action",
            "action_effective"
          ],
          "properties": {
            "leverage_exposure": {"$ref": "#/$defs/decimal"},
            "leverage_required": {"$ref": "#/$defs/decimal"},
            "Tier1": {"$ref": "#/$defs/decimal"},
            "capital_KVA": {"$ref": "#/$defs/decimal"},
            "structural_value": {"$ref": "#/$defs/decimal"},
            "capital_cash_credit": {"$ref": "#/$defs/decimal"},
            "binding": {
              "type": "string",
              "enum": ["risk_weighted", "leverage"]
            },
            "chosen_action": {
              "type": "string",
              "enum": ["CSA", "substitute", "netting", "CDS", "hold", "release_substitution"]
            },
            "action_effective": {"type": "boolean"}
          }
        },
        "allocation": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "objective_cost",
            "cash_raised",
            "required_cash",
            "feasible",
            "optimal",
            "lower_bound",
            "assignment",
            "evidence_dependent_unknowns"
          ],
          "properties": {
            "objective_cost": {"$ref": "#/$defs/decimal"},
            "cash_raised": {"$ref": "#/$defs/decimal"},
            "required_cash": {"$ref": "#/$defs/decimal"},
            "feasible": {"type": "boolean"},
            "optimal": {"type": "boolean"},
            "lower_bound": {"$ref": "#/$defs/decimal"},
            "assignment": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": ["lot_id", "lender_id"],
                "properties": {
                  "lot_id": {"type": "string"},
                  "lender_id": {"type": "string"}
                }
              }
            },
            "evidence_dependent_unknowns": {
              "type": "array",
              "items": {"type": "string", "minLength": 1}
            }
          }
        },
        "evidence": {"$ref": "#/$defs/evidence"}
      }
    },
    "liquidity": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "branch",
        "branch_event",
        "default",
        "collateral_market_value",
        "collateral_cash_realisation",
        "call_due",
        "cash_available",
        "additional_borrowing",
        "residual_liquidity_shortfall",
        "reference_exists",
        "structure_decision",
        "correct_by_contract_not_label",
        "evidence"
      ],
      "properties": {
        "branch": {
          "type": "string",
          "enum": ["W1", "W2", "W3", "W4"]
        },
        "branch_event": {
          "type": "string",
          "enum": ["joint_default", "transfer_ban_without_default", "joint_funding_EM_widening", "market_closed"]
        },
        "default": {"type": "boolean"},
        "collateral_market_value": {"$ref": "#/$defs/decimal"},
        "collateral_cash_realisation": {"$ref": "#/$defs/decimal"},
        "call_due": {"$ref": "#/$defs/decimal"},
        "cash_available": {"$ref": "#/$defs/decimal"},
        "additional_borrowing": {"$ref": "#/$defs/decimal"},
        "residual_liquidity_shortfall": {"$ref": "#/$defs/decimal"},
        "reference_exists": {"type": "boolean"},
        "structure_decision": {
          "type": "string",
          "enum": ["issued_security_required", "DPR_transfer_risk", "joint_spread_funding_risk", "closed_market_cash_risk"]
        },
        "correct_by_contract_not_label": {"type": "boolean"},
        "evidence": {"$ref": "#/$defs/evidence"}
      }
    },
    "accounting": {
      "type": "object",
      "additionalProperties": false,
      "required": ["recognition", "reserves", "evidence"],
      "properties": {
        "recognition": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "unit",
            "internal_addon_observable",
            "day1_statutory_profit",
            "deferred_management_gain",
            "release_trigger",
            "gross_pots_reconciled_to_unit",
            "management_IFRS_bridge"
          ],
          "properties": {
            "unit": {
              "type": "string",
              "enum": ["retained_asset_financing", "standalone_derivative"]
            },
            "internal_addon_observable": {"type": "boolean"},
            "day1_statutory_profit": {
              "$ref": "#/$defs/decimal",
              "description": "Recognisable inception funding-opportunity gain before the separately paid service fee. This is not total statutory day-one P&L; the cash ledger includes the service expense and resulting equity reduction."
            },
            "deferred_management_gain": {"$ref": "#/$defs/decimal"},
            "release_trigger": {
              "type": "string",
              "enum": ["priced_time_or_observability", "spread_tightening", "arbitrary_time"]
            },
            "gross_pots_reconciled_to_unit": {"type": "boolean"},
            "management_IFRS_bridge": {"type": "boolean"}
          }
        },
        "reserves": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "D_open",
            "D_close",
            "X_open",
            "X_close",
            "carry",
            "clean_mtm",
            "deferral_release",
            "reserve_theta",
            "reserve_mtm",
            "reserve_action",
            "hedge_pnl",
            "cash_funding_drag",
            "reported_pnl",
            "independent_equity_change",
            "AVA",
            "CET1_after_AVA",
            "unfunded_reserve_balance",
            "terminal_reserve",
            "AVA_in_PnL",
            "all_obligations_settled",
            "reserve_charge_alone_draws_debt",
            "expected_release_counted_twice"
          ],
          "properties": {
            "D_open": {"$ref": "#/$defs/decimal"},
            "D_close": {"$ref": "#/$defs/decimal"},
            "X_open": {"$ref": "#/$defs/decimal"},
            "X_close": {"$ref": "#/$defs/decimal"},
            "carry": {"$ref": "#/$defs/decimal"},
            "clean_mtm": {"$ref": "#/$defs/decimal"},
            "deferral_release": {"$ref": "#/$defs/decimal"},
            "reserve_theta": {"$ref": "#/$defs/decimal"},
            "reserve_mtm": {"$ref": "#/$defs/decimal"},
            "reserve_action": {"$ref": "#/$defs/decimal"},
            "hedge_pnl": {"$ref": "#/$defs/decimal"},
            "cash_funding_drag": {"$ref": "#/$defs/decimal"},
            "reported_pnl": {"$ref": "#/$defs/decimal"},
            "independent_equity_change": {"$ref": "#/$defs/decimal"},
            "AVA": {"$ref": "#/$defs/decimal"},
            "CET1_after_AVA": {"$ref": "#/$defs/decimal"},
            "unfunded_reserve_balance": {"$ref": "#/$defs/decimal"},
            "terminal_reserve": {"$ref": "#/$defs/decimal"},
            "AVA_in_PnL": {"type": "boolean"},
            "all_obligations_settled": {"type": "boolean"},
            "reserve_charge_alone_draws_debt": {"type": "boolean"},
            "expected_release_counted_twice": {"type": "boolean"}
          }
        },
        "evidence": {"$ref": "#/$defs/evidence"}
      }
    }
  },
  "$defs": {
    "decimal": {
      "type": "string",
      "pattern": "^-?(0|[1-9][0-9]*)(\\.[0-9]+)?(?![\\s\\S])",
      "description": "Finite decimal string without exponent notation, NaN or infinity."
    },
    "evidence": {
      "type": "array",
      "description": "Required array. An empty array is structurally valid but fails every owner whose required panel citations are absent; the denominator stays 100.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["exhibit_id", "locator", "claim"],
        "properties": {
          "exhibit_id": {"type": "string"},
          "locator": {"type": "string"},
          "claim": {
            "type": "string",
            "pattern": "^[A-Z][A-Z0-9_]*(?![\\s\\S])",
            "description": "Exactly one financial reporting_panels panel_id for the selected case. Explanatory suffixes and free prose are rejected in claim; institutional reasoning uses typed premises in its own sections."
          }
        }
      }
    }
  }
}
