{
  "openapi": "3.1.0",
  "info": {
    "title": "MasteryHive Reconciliation \u2014 Engine (includes INTERNAL routes)",
    "version": "0.1.0",
    "description": "Contains /internal/* mesh routes \u2014 not for partners. Partner reconcile paths are platform-operated. Local servers only."
  },
  "servers": [
    {
      "url": "http://localhost:8000/v1",
      "description": "Local mesh placeholder \u2014 replace host; keep /v1 prefix. Cloud bases require owner decision."
    }
  ],
  "paths": {
    "/": {
      "get": {
        "summary": "Home",
        "operationId": "home__get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "summary": "Health",
        "operationId": "health_health_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/reconcile/complete-batch": {
      "post": {
        "tags": [
          "Reconciliation"
        ],
        "summary": "Called by Pub/Sub push when a date window finishes",
        "operationId": "complete_batch_reconcile_complete_batch_post",
        "responses": {
          "202": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/reconcile/banking": {
      "post": {
        "tags": [
          "Reconciliation"
        ],
        "summary": "Run banking reconciliation (called by ingestion after ETL)",
        "operationId": "reconcile_banking_reconcile_banking_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReconcileRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/reconcile/commercial": {
      "post": {
        "tags": [
          "Reconciliation"
        ],
        "summary": "Run commercial reconciliation (ATM/card, or NIP for Lotus Bank)",
        "operationId": "reconcile_commercial_reconcile_commercial_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommercialReconcileRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/reconcile/asset": {
      "post": {
        "tags": [
          "Reconciliation"
        ],
        "summary": "Run Fund Management asset reconciliation (holdings vs custodian)",
        "operationId": "reconcile_asset_reconcile_asset_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReconcileRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/reconcile/reprocess-cross-month/background": {
      "post": {
        "tags": [
          "Reconciliation"
        ],
        "summary": "Match unmatched GL from prior months against current bank statements",
        "operationId": "reprocess_cross_month_reconcile_reprocess_cross_month_background_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CrossMonthReprocessRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/reconcile/target-field-suggestion": {
      "post": {
        "tags": [
          "Reconciliation"
        ],
        "summary": "Suggest target column/field mapping for GL and Bank files",
        "operationId": "column_match_reconcile_target_field_suggestion_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ColumnMatchRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/internal/match/banking": {
      "post": {
        "tags": [
          "Internal",
          "internal"
        ],
        "summary": "Match Banking",
        "description": "The core-engine-calling half of banking's not_found resolution \u2014\nsee `internal_match/banking.py`'s own docstring.\n\n**INTERNAL** \u2014 not a partner surface.",
        "operationId": "match_banking_internal_match_banking_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BankingMatchRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankingMatchResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-internal": true
      }
    },
    "/internal/match/nip": {
      "post": {
        "tags": [
          "Internal",
          "internal"
        ],
        "summary": "Match Nip",
        "description": "NIP's whole not_found approved-and-matched pipeline \u2014 see\n`internal_match/nip.py`'s own docstring.\n\n**INTERNAL** \u2014 not a partner surface.",
        "operationId": "match_nip_internal_match_nip_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NipMatchRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NipMatchResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-internal": true
      }
    },
    "/internal/ingest/banking-document": {
      "post": {
        "tags": [
          "Internal",
          "internal"
        ],
        "summary": "Ingest Banking Document Route",
        "description": "Wraps `ingest_banking_document` (LLM column-mapping inference +\n`MicroFinanceBankReconciliationETL`) for the \"approved with uploaded\nGL/bank file\" banking resolve path \u2014 see\n`internal_match/banking_ingest.py`'s own docstring.\n\n**INTERNAL** \u2014 not a partner surface.",
        "operationId": "ingest_banking_document_route_internal_ingest_banking_document_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BankingIngestRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankingIngestResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-internal": true
      }
    },
    "/internal/summary/regenerate/nip": {
      "post": {
        "tags": [
          "Internal",
          "internal"
        ],
        "summary": "Regenerate Nip Summary Route",
        "description": "Recalculates and appends a fresh nip_summary row for this session \u2014\nsee `internal_match/summary_nip.py`'s own docstring. Called by\nexception-service's summary_generation module right after a `resolve()`\ncall successfully resolves clusters for this session.\n\n**INTERNAL** \u2014 not a partner surface.",
        "operationId": "regenerate_nip_summary_route_internal_summary_regenerate_nip_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SummaryRegenerateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SummaryRegenerateResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-internal": true
      }
    },
    "/internal/summary/regenerate/banking": {
      "post": {
        "tags": [
          "Internal",
          "internal"
        ],
        "summary": "Regenerate Banking Summary Route",
        "description": "Recalculates and appends a fresh `summary` row for this session, and\nPATCHes the loader service with the full update shape \u2014 see\n`internal_match/summary_banking.py`'s own docstring. Called by\nexception-service's summary_generation module right after a `resolve()`\ncall successfully resolves clusters for this session.\n\n**INTERNAL** \u2014 not a partner surface.",
        "operationId": "regenerate_banking_summary_route_internal_summary_regenerate_banking_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SummaryRegenerateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SummaryRegenerateResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-internal": true
      }
    }
  },
  "components": {
    "schemas": {
      "BankService": {
        "type": "string",
        "enum": [
          "transfers",
          "pos",
          "ussd",
          "bill_payments",
          "card_settlement",
          "cash_deposits",
          "pos_deposits",
          "atm",
          "nip",
          "other"
        ],
        "title": "BankService",
        "description": "Bank service types"
      },
      "BankingIngestRequest": {
        "properties": {
          "gl_file_url": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Gl File Url",
            "default": []
          },
          "bank_file_url": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Bank File Url",
            "default": []
          },
          "partner_id": {
            "type": "string",
            "title": "Partner Id"
          },
          "tenant_id": {
            "type": "string",
            "title": "Tenant Id"
          },
          "branch_id": {
            "type": "string",
            "title": "Branch Id"
          },
          "session_id": {
            "type": "string",
            "title": "Session Id"
          },
          "start_date": {
            "type": "string",
            "title": "Start Date"
          },
          "end_date": {
            "type": "string",
            "title": "End Date"
          },
          "mappings": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/ColumnMapping"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mappings"
          },
          "others": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/OthersMapping"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "type": "object",
        "required": [
          "partner_id",
          "tenant_id",
          "branch_id",
          "session_id",
          "start_date",
          "end_date"
        ],
        "title": "BankingIngestRequest"
      },
      "BankingIngestResponse": {
        "properties": {
          "success": {
            "type": "boolean",
            "title": "Success",
            "default": true
          }
        },
        "type": "object",
        "title": "BankingIngestResponse"
      },
      "BankingMatchRequest": {
        "properties": {
          "tenant_id": {
            "type": "string",
            "title": "Tenant Id"
          },
          "partner_id": {
            "type": "string",
            "title": "Partner Id"
          },
          "branch_id": {
            "type": "string",
            "title": "Branch Id"
          },
          "domain": {
            "type": "string",
            "title": "Domain",
            "default": "mfb"
          },
          "cluster_type": {
            "type": "string",
            "title": "Cluster Type"
          },
          "start_date": {
            "type": "string",
            "title": "Start Date"
          },
          "end_date": {
            "type": "string",
            "title": "End Date"
          },
          "matching_method": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Matching Method"
          },
          "amount_tolerance": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Amount Tolerance"
          },
          "recon_time_search_forward": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Recon Time Search Forward"
          },
          "recon_time_search_backward": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Recon Time Search Backward"
          },
          "cluster_ids": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cluster Ids"
          }
        },
        "type": "object",
        "required": [
          "tenant_id",
          "partner_id",
          "branch_id",
          "cluster_type",
          "start_date",
          "end_date"
        ],
        "title": "BankingMatchRequest"
      },
      "BankingMatchResponse": {
        "properties": {
          "matches": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Matches"
          }
        },
        "type": "object",
        "required": [
          "matches"
        ],
        "title": "BankingMatchResponse"
      },
      "ColumnMapping": {
        "properties": {
          "system": {
            "type": "string",
            "title": "System",
            "description": "System field name"
          },
          "gl_title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Gl Title",
            "description": "General Ledger column title"
          },
          "statement_title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Statement Title",
            "description": "Bank Statement column title"
          },
          "secondary_mappings": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/SecondaryMapping"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Secondary Mappings",
            "description": "Secondary mappings for GL and Statement"
          }
        },
        "type": "object",
        "required": [
          "system"
        ],
        "title": "ColumnMapping"
      },
      "ColumnMatchRequest": {
        "properties": {
          "gl_file_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            ],
            "title": "Gl File Url",
            "description": "GL file URL(s). Can be single string or array."
          },
          "bank_file_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            ],
            "title": "Bank File Url",
            "description": "Bank file URL(s). Can be single string or array."
          },
          "target_field_definitions": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TargetFieldDefinitions"
              },
              {
                "type": "null"
              }
            ],
            "description": "Dynamic field definitions. Snake_case keys auto-converted to Title Case."
          },
          "mappings": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/ColumnMapping"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mappings",
            "description": "Pre-defined column mappings (alternative to target_field_definitions)"
          },
          "others": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/OthersMapping"
              },
              {
                "type": "null"
              }
            ],
            "description": "Other unmapped columns for GL/Statement"
          },
          "customer_type": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ReconciliationCustomerTypeEnum"
              },
              {
                "type": "null"
              }
            ],
            "description": "Customer type; selects the default target_field_definitions when none are provided."
          },
          "is_switch": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Switch",
            "description": "Set true for an Interswitch statement; derives switch_type."
          }
        },
        "type": "object",
        "required": [
          "gl_file_url",
          "bank_file_url"
        ],
        "title": "ColumnMatchRequest"
      },
      "CommercialReconcileRequest": {
        "properties": {
          "session_id": {
            "type": "string",
            "title": "Session Id"
          },
          "tenant_id": {
            "type": "string",
            "title": "Tenant Id"
          },
          "partner_id": {
            "type": "string",
            "title": "Partner Id"
          },
          "branch_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Branch Id"
          },
          "period_start_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Period Start Date"
          },
          "period_end_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Period End Date"
          },
          "msc_rate": {
            "type": "number",
            "title": "Msc Rate",
            "default": 0.0
          },
          "amount_tolerance": {
            "type": "number",
            "title": "Amount Tolerance",
            "default": 0.0
          },
          "charge_min": {
            "type": "number",
            "title": "Charge Min",
            "default": 0.0
          },
          "charge_max": {
            "type": "number",
            "title": "Charge Max",
            "default": 0.0
          },
          "search_mode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Search Mode"
          },
          "matching_method": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Matching Method"
          },
          "customer_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Customer Type"
          },
          "reconciliation_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reconciliation Type"
          },
          "gl_file_url": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Gl File Url"
          },
          "bank_file_url": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Bank File Url"
          },
          "max_days_forward_search": {
            "type": "integer",
            "title": "Max Days Forward Search",
            "default": 0
          },
          "max_days_backward_search": {
            "type": "integer",
            "title": "Max Days Backward Search",
            "default": 0
          },
          "event_dates": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/EventDate"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Event Dates"
          },
          "ingress_task_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ingress Task Id"
          },
          "records_create_task_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Records Create Task Id"
          },
          "gl_reversal_task_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Gl Reversal Task Id"
          },
          "reconciliation_task_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reconciliation Task Id"
          },
          "matched_records_task_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Matched Records Task Id"
          },
          "chargeback_task_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Chargeback Task Id"
          },
          "summary_task_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Summary Task Id"
          },
          "is_scheduled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Scheduled"
          },
          "exclude_debits_from_rate": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Exclude Debits From Rate",
            "default": true
          },
          "exception_analysis_enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Exception Analysis Enabled",
            "default": true
          },
          "on_existing_action": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "On Existing Action",
            "default": "overwrite"
          },
          "custodian_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Custodian Id"
          },
          "custodian_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Custodian Name"
          },
          "reconciliation_flow": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "inward",
                  "outward"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Reconciliation Flow"
          },
          "service": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ServiceType"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "type": "object",
        "required": [
          "session_id",
          "tenant_id",
          "partner_id"
        ],
        "title": "CommercialReconcileRequest",
        "description": "Request model for the single /commercial endpoint -- superset of\nReconcileRequest carrying whatever either ATM or NIP reconciliation\nneeds. `service` is the discriminator CommercialReconciliationRouter\nuses to decide which one this request actually is (ServiceType.NIP ->\nNIP reconciliation, anything else -> ATM)."
      },
      "CrossMonthReprocessRequest": {
        "properties": {
          "session_id": {
            "type": "string",
            "title": "Session Id"
          },
          "tenant_id": {
            "type": "string",
            "title": "Tenant Id"
          },
          "partner_id": {
            "type": "string",
            "title": "Partner Id"
          },
          "branch_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Branch Id"
          },
          "period_start_date": {
            "type": "string",
            "title": "Period Start Date"
          },
          "period_end_date": {
            "type": "string",
            "title": "Period End Date"
          },
          "template": {
            "$ref": "#/components/schemas/ReconciliationTemplateCreate"
          },
          "months_back": {
            "type": "integer",
            "title": "Months Back",
            "default": 1
          },
          "is_scheduled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Scheduled"
          },
          "summary_task_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Summary Task Id"
          },
          "matched_records_task_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Matched Records Task Id"
          },
          "chargeback_task_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Chargeback Task Id"
          }
        },
        "type": "object",
        "required": [
          "session_id",
          "tenant_id",
          "partner_id",
          "period_start_date",
          "period_end_date",
          "template"
        ],
        "title": "CrossMonthReprocessRequest"
      },
      "EventDate": {
        "properties": {
          "start_date": {
            "type": "string",
            "format": "date",
            "title": "Start Date"
          },
          "end_date": {
            "type": "string",
            "format": "date",
            "title": "End Date"
          }
        },
        "type": "object",
        "required": [
          "start_date",
          "end_date"
        ],
        "title": "EventDate"
      },
      "FeeDisplayType": {
        "type": "string",
        "enum": [
          "netted",
          "separate"
        ],
        "title": "FeeDisplayType",
        "description": "Fee display types"
      },
      "FeeType": {
        "type": "string",
        "enum": [
          "fixed",
          "percentage"
        ],
        "title": "FeeType",
        "description": "Fee calculation types"
      },
      "GLType": {
        "type": "string",
        "enum": [
          "income",
          "nip_fee"
        ],
        "title": "GLType",
        "description": "General Ledger types"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "MatchingMethod": {
        "type": "string",
        "enum": [
          "line_by_line",
          "bulk",
          "lump_sum",
          "line_by_line_and_lump_sum"
        ],
        "title": "MatchingMethod",
        "description": "Matching methods for reconciliation"
      },
      "NipMatchRequest": {
        "properties": {
          "tenant_id": {
            "type": "string",
            "title": "Tenant Id"
          },
          "partner_id": {
            "type": "string",
            "title": "Partner Id"
          },
          "branch_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Branch Id"
          },
          "domain": {
            "type": "string",
            "title": "Domain"
          },
          "cluster_type": {
            "type": "string",
            "title": "Cluster Type"
          },
          "gl_file_url": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Gl File Url",
            "default": []
          },
          "bank_file_url": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Bank File Url",
            "default": []
          },
          "ingestion_session_id": {
            "type": "string",
            "title": "Ingestion Session Id"
          },
          "start_date": {
            "type": "string",
            "title": "Start Date"
          },
          "end_date": {
            "type": "string",
            "title": "End Date"
          }
        },
        "type": "object",
        "required": [
          "tenant_id",
          "partner_id",
          "domain",
          "cluster_type",
          "ingestion_session_id",
          "start_date",
          "end_date"
        ],
        "title": "NipMatchRequest"
      },
      "NipMatchResponse": {
        "properties": {
          "gl_resolved_row_uids": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Gl Resolved Row Uids"
          },
          "bank_resolved_row_uids": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Bank Resolved Row Uids"
          },
          "enrichment_by_row_uid": {
            "additionalProperties": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "object",
            "title": "Enrichment By Row Uid"
          },
          "matched_cba": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Matched Cba",
            "default": []
          },
          "matched_nip": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Matched Nip",
            "default": []
          }
        },
        "type": "object",
        "required": [
          "gl_resolved_row_uids",
          "bank_resolved_row_uids",
          "enrichment_by_row_uid"
        ],
        "title": "NipMatchResponse"
      },
      "OthersMapping": {
        "properties": {
          "gl": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Gl",
            "description": "Other GL column mappings"
          },
          "statement": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Statement",
            "description": "Other Statement column mappings"
          }
        },
        "type": "object",
        "title": "OthersMapping"
      },
      "ReconcileRequest": {
        "properties": {
          "session_id": {
            "type": "string",
            "title": "Session Id"
          },
          "tenant_id": {
            "type": "string",
            "title": "Tenant Id"
          },
          "partner_id": {
            "type": "string",
            "title": "Partner Id"
          },
          "branch_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Branch Id"
          },
          "period_start_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Period Start Date"
          },
          "period_end_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Period End Date"
          },
          "msc_rate": {
            "type": "number",
            "title": "Msc Rate",
            "default": 0.0
          },
          "amount_tolerance": {
            "type": "number",
            "title": "Amount Tolerance",
            "default": 0.0
          },
          "charge_min": {
            "type": "number",
            "title": "Charge Min",
            "default": 0.0
          },
          "charge_max": {
            "type": "number",
            "title": "Charge Max",
            "default": 0.0
          },
          "search_mode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Search Mode"
          },
          "matching_method": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Matching Method"
          },
          "customer_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Customer Type"
          },
          "reconciliation_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reconciliation Type"
          },
          "gl_file_url": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Gl File Url"
          },
          "bank_file_url": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Bank File Url"
          },
          "max_days_forward_search": {
            "type": "integer",
            "title": "Max Days Forward Search",
            "default": 0
          },
          "max_days_backward_search": {
            "type": "integer",
            "title": "Max Days Backward Search",
            "default": 0
          },
          "event_dates": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/EventDate"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Event Dates"
          },
          "ingress_task_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ingress Task Id"
          },
          "records_create_task_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Records Create Task Id"
          },
          "gl_reversal_task_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Gl Reversal Task Id"
          },
          "reconciliation_task_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reconciliation Task Id"
          },
          "matched_records_task_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Matched Records Task Id"
          },
          "chargeback_task_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Chargeback Task Id"
          },
          "summary_task_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Summary Task Id"
          },
          "is_scheduled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Scheduled"
          },
          "exclude_debits_from_rate": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Exclude Debits From Rate",
            "default": true
          },
          "exception_analysis_enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Exception Analysis Enabled",
            "default": true
          },
          "on_existing_action": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "On Existing Action",
            "default": "overwrite"
          },
          "custodian_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Custodian Id"
          },
          "custodian_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Custodian Name"
          }
        },
        "type": "object",
        "required": [
          "session_id",
          "tenant_id",
          "partner_id"
        ],
        "title": "ReconcileRequest"
      },
      "ReconciliationCustomerTypeEnum": {
        "type": "string",
        "enum": [
          "mfb",
          "commercial_bank",
          "payment_provider",
          "lender",
          "fund_manager"
        ],
        "title": "ReconciliationCustomerTypeEnum"
      },
      "ReconciliationRuleCreate": {
        "properties": {
          "bank_service": {
            "$ref": "#/components/schemas/BankService",
            "description": "Bank service type"
          },
          "min_amount": {
            "type": "number",
            "title": "Min Amount",
            "description": "Minimum transaction amount",
            "default": 0.0
          },
          "max_amount": {
            "type": "number",
            "title": "Max Amount",
            "description": "Maximum transaction amount",
            "default": 0.0
          },
          "amount": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Amount",
            "description": "Rule amount"
          },
          "fee_type": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/FeeType"
              },
              {
                "type": "null"
              }
            ],
            "description": "Fee calculation type"
          },
          "rule_definitions": {
            "items": {
              "$ref": "#/components/schemas/RuleDefinitionCreate"
            },
            "type": "array",
            "minItems": 1,
            "title": "Rule Definitions",
            "description": "List of rule definitions"
          }
        },
        "type": "object",
        "required": [
          "bank_service",
          "rule_definitions"
        ],
        "title": "ReconciliationRuleCreate",
        "description": "Schema for creating reconciliation rules"
      },
      "ReconciliationTemplateCreate": {
        "properties": {
          "service": {
            "$ref": "#/components/schemas/ServiceType",
            "description": "Service type for reconciliation"
          },
          "is_reversal": {
            "type": "boolean",
            "title": "Is Reversal",
            "description": "Perform GL Reversal",
            "default": true
          },
          "matching_method": {
            "$ref": "#/components/schemas/MatchingMethod",
            "description": "Matching method for reconciliation"
          },
          "max_days_backward_search": {
            "type": "integer",
            "minimum": 0.0,
            "title": "Max Days Backward Search",
            "description": "Maximum days to search backward for matches"
          },
          "max_days_forward_search": {
            "type": "integer",
            "minimum": 0.0,
            "title": "Max Days Forward Search",
            "description": "Maximum days to search forward for matches"
          },
          "reversal_max_days_backward_search": {
            "type": "integer",
            "minimum": 0.0,
            "title": "Reversal Max Days Backward Search",
            "description": "Maximum days to search backward for reversals"
          },
          "reversal_max_days_forward_search": {
            "type": "integer",
            "minimum": 0.0,
            "title": "Reversal Max Days Forward Search",
            "description": "Maximum days to search forward for reversals"
          },
          "search_mode": {
            "type": "string",
            "title": "Search Mode",
            "description": "Search Mode"
          },
          "fee_display_type": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/FeeDisplayType"
              },
              {
                "type": "null"
              }
            ],
            "description": "How fees should be displayed: 'netted' (combined with transaction) or 'separate' (shown separately)"
          },
          "rules": {
            "items": {
              "$ref": "#/components/schemas/ReconciliationRuleCreate"
            },
            "type": "array",
            "title": "Rules",
            "description": "List of reconciliation rules"
          }
        },
        "type": "object",
        "required": [
          "service",
          "matching_method",
          "max_days_backward_search",
          "max_days_forward_search",
          "reversal_max_days_backward_search",
          "reversal_max_days_forward_search"
        ],
        "title": "ReconciliationTemplateCreate",
        "description": "Schema for creating reconciliation templates",
        "example": {
          "is_draft": false,
          "matching_method": "line_by_line",
          "max_days_backward_search": 7,
          "max_days_forward_search": 3,
          "name": "Card Settlement Template",
          "reversal_max_days_backward_search": 14,
          "reversal_max_days_forward_search": 7,
          "rules": [
            {
              "amount": 0.0,
              "bank_service": "pos",
              "fee_type": "percentage",
              "max_amount": 0.0,
              "min_amount": 0.0,
              "rule_definitions": [
                {
                  "amount": 100.0,
                  "entry": "debit",
                  "gl_type": "income",
                  "split_type": "fixed"
                },
                {
                  "amount": 2.5,
                  "entry": "credit",
                  "gl_type": "nip_fee",
                  "split_type": "percentage"
                }
              ]
            },
            {
              "amount": 25000.0,
              "bank_service": "transfers",
              "fee_type": "fixed",
              "max_amount": 0.0,
              "min_amount": 0.0,
              "rule_definitions": [
                {
                  "amount": 50.0,
                  "entry": "debit",
                  "gl_type": "income",
                  "split_type": "fixed"
                }
              ]
            }
          ],
          "service": "card_settlement"
        }
      },
      "RuleDefinitionCreate": {
        "properties": {
          "gl_type": {
            "$ref": "#/components/schemas/GLType",
            "description": "General Ledger type"
          },
          "amount": {
            "type": "number",
            "title": "Amount",
            "description": "Amount for the rule definition"
          },
          "entry": {
            "type": "string",
            "title": "Entry",
            "description": "Entry type (debit/credit)"
          },
          "split_type": {
            "$ref": "#/components/schemas/SplitType",
            "description": "Split calculation type"
          },
          "msc_rate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Msc Rate",
            "description": "MSC rate (e.g. 0.0025 = 0.25%)"
          }
        },
        "type": "object",
        "required": [
          "gl_type",
          "amount",
          "entry",
          "split_type"
        ],
        "title": "RuleDefinitionCreate",
        "description": "Schema for creating rule definitions"
      },
      "SecondaryMapping": {
        "properties": {
          "gl_title": {
            "type": "string",
            "title": "Gl Title"
          },
          "statement_title": {
            "type": "string",
            "title": "Statement Title"
          }
        },
        "type": "object",
        "required": [
          "gl_title",
          "statement_title"
        ],
        "title": "SecondaryMapping"
      },
      "ServiceType": {
        "type": "string",
        "enum": [
          "card_settlement",
          "transfers",
          "cash_deposits",
          "pos_deposits",
          "pos",
          "ussd",
          "bill_payments",
          "atm",
          "nip",
          "other"
        ],
        "title": "ServiceType",
        "description": "Service types for reconciliation templates"
      },
      "SplitType": {
        "type": "string",
        "enum": [
          "fixed",
          "percentage"
        ],
        "title": "SplitType",
        "description": "Split calculation types"
      },
      "SummaryRegenerateRequest": {
        "properties": {
          "tenant_id": {
            "type": "string",
            "title": "Tenant Id"
          },
          "partner_id": {
            "type": "string",
            "title": "Partner Id"
          },
          "session_id": {
            "type": "string",
            "title": "Session Id"
          }
        },
        "type": "object",
        "required": [
          "tenant_id",
          "partner_id",
          "session_id"
        ],
        "title": "SummaryRegenerateRequest"
      },
      "SummaryRegenerateResponse": {
        "properties": {
          "summary_text": {
            "type": "string",
            "title": "Summary Text"
          },
          "ai_summary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ai Summary"
          },
          "msc_rate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Msc Rate"
          },
          "gl_opening_balance": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Gl Opening Balance"
          },
          "gl_closing_balance": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Gl Closing Balance"
          },
          "statement_opening_balance": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Statement Opening Balance"
          },
          "statement_closing_balance": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Statement Closing Balance"
          },
          "gl_account_number": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Gl Account Number"
          },
          "statement_account_number": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Statement Account Number"
          },
          "is_scheduled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Scheduled"
          },
          "partner_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Partner Id"
          },
          "period_start_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Period Start Date"
          },
          "period_end_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Period End Date"
          },
          "ai_statistics": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ai Statistics"
          }
        },
        "type": "object",
        "required": [
          "summary_text"
        ],
        "title": "SummaryRegenerateResponse",
        "description": "Same field set as loader's `UpdateRequest` (see\n`microservices/loader/src/loader/datamodels/schema.py`), plus\n`summary_text` \u2014 everything a resolution-triggered caller needs to\nreuse as `reconciliationUpdates` on the classification/exceptions DTO\n(see exception-service's `exception_resolution/service.py::_finish`).\n`msc_rate`/`is_scheduled` have no durable source at regeneration time\n(see summary_banking.py's own docstring) \u2014 always None here."
      },
      "TargetFieldDefinitions": {
        "additionalProperties": {
          "type": "string"
        },
        "type": "object",
        "title": "TargetFieldDefinitions",
        "description": "RootModel wrapper around Dict[str,str] so request bodies look like a plain mapping.\nAccepts snake_case keys and converts them to Title Case."
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    }
  }
}
