{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Q03 reconciliation input schema",
  "description": "Strict input shape. Blank templates are preparation scaffolds, not runnable inputs.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "account_id",
    "currency",
    "cutoff_date",
    "bank_closing_cents",
    "firm_ledger_closing_cents",
    "approved_bank_adjustments",
    "client_balances",
    "transactions"
  ],
  "properties": {
    "account_id": {
      "type": "string",
      "minLength": 1
    },
    "currency": {
      "type": "string",
      "minLength": 1
    },
    "cutoff_date": {
      "type": "string",
      "format": "date",
      "minLength": 1
    },
    "bank_closing_cents": {
      "type": "integer"
    },
    "firm_ledger_closing_cents": {
      "type": "integer"
    },
    "approved_bank_adjustments": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "adjustment_id",
          "signed_cents",
          "source_ref",
          "approved_by"
        ],
        "properties": {
          "adjustment_id": {
            "type": "string",
            "minLength": 1
          },
          "signed_cents": {
            "type": "integer"
          },
          "source_ref": {
            "type": "string"
          },
          "approved_by": {
            "type": "string"
          }
        }
      }
    },
    "client_balances": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "client_id",
          "balance_cents",
          "source_ref"
        ],
        "properties": {
          "client_id": {
            "type": "string",
            "minLength": 1
          },
          "balance_cents": {
            "type": "integer"
          },
          "source_ref": {
            "type": "string"
          }
        }
      }
    },
    "transactions": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "transaction_id",
          "client_id",
          "signed_cents",
          "bank_match_id",
          "classification",
          "source_ref"
        ],
        "properties": {
          "transaction_id": {
            "type": "string",
            "minLength": 1
          },
          "client_id": {
            "type": "string"
          },
          "signed_cents": {
            "type": "integer"
          },
          "bank_match_id": {
            "type": "string"
          },
          "classification": {
            "type": "string",
            "enum": [
              "cleared",
              "outstanding",
              "unresolved"
            ]
          },
          "source_ref": {
            "type": "string"
          }
        }
      }
    }
  }
}
