{
  "openapi": "3.0.3",
  "info": {
    "title": "custapi API draft",
    "version": "0.1.0",
    "description": "Draft OpenAPI contract generated from COBOL and copybook analysis. Manual validation required."
  },
  "paths": {
    "/custapi": {
      "post": {
        "summary": "Invoke custapi",
        "operationId": "invoke_custapi",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CobolPayload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CobolPayload"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CobolPayload": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "title": "Sample_Cobol_V2_Customer_Account_Record",
        "type": "object",
        "properties": {
          "cr_customer_id": {
            "type": "string",
            "maxLength": 12
          },
          "cr_customer_name": {
            "type": "string",
            "maxLength": 60
          },
          "cr_account_id": {
            "type": "string",
            "maxLength": 18
          },
          "cr_account_balance": {
            "type": "number",
            "multipleOf": 0.01,
            "description": "COBOL PIC S9(11)V99 COMP-3"
          },
          "cr_account_status": {
            "type": "string",
            "maxLength": 1
          },
          "cr_security_group": {
            "type": "string",
            "maxLength": 8
          },
          "cr_raw_data": {
            "type": "string",
            "maxLength": 120
          },
          "cr_segment_code": {
            "type": "string",
            "maxLength": 4
          },
          "cr_segment_payload": {
            "type": "string",
            "maxLength": 116
          },
          "ws_return_code": {
            "type": "integer",
            "description": "COBOL PIC S9(4) COMP"
          },
          "ws_sqlcode": {
            "type": "integer",
            "description": "COBOL PIC S9(9) COMP"
          },
          "ws_db2_customer_id": {
            "type": "string",
            "maxLength": 12
          },
          "ws_api_trace_id": {
            "type": "string",
            "maxLength": 36
          },
          "ws_counter": {
            "type": "integer",
            "description": "COBOL PIC 9(4) COMP"
          },
          "ws_error_flag": {
            "type": "string",
            "maxLength": 1
          },
          "req_trace_id": {
            "type": "string",
            "maxLength": 36
          },
          "req_channel": {
            "type": "string",
            "maxLength": 10
          },
          "req_timestamp": {
            "type": "string",
            "maxLength": 26
          },
          "req_customer_id": {
            "type": "string",
            "maxLength": 12
          },
          "req_account_id": {
            "type": "string",
            "maxLength": 18
          },
          "req_ssn": {
            "type": "string",
            "maxLength": 11
          },
          "req_card_number": {
            "type": "integer",
            "description": "COBOL PIC X(19)"
          },
          "req_include_history": {
            "type": "string",
            "maxLength": 1
          },
          "req_max_rows": {
            "type": "integer",
            "description": "COBOL PIC 9(4) COMP"
          },
          "req_filter_name": {
            "type": "string",
            "maxLength": 20
          },
          "req_filter_value": {
            "type": "string",
            "maxLength": 80
          },
          "resp_trace_id": {
            "type": "string",
            "maxLength": 36
          },
          "resp_status_code": {
            "type": "string",
            "maxLength": 8
          },
          "resp_message": {
            "type": "string",
            "maxLength": 120
          },
          "resp_customer_id": {
            "type": "string",
            "maxLength": 12
          },
          "resp_customer_name": {
            "type": "string",
            "maxLength": 60
          },
          "resp_account_balance": {
            "type": "number",
            "multipleOf": 0.01,
            "description": "COBOL PIC S9(11)V99 COMP-3"
          },
          "resp_history_count": {
            "type": "integer",
            "description": "COBOL PIC 9(4) COMP"
          },
          "resp_hist_date": {
            "type": "string",
            "maxLength": 10
          },
          "resp_hist_amount": {
            "type": "number",
            "multipleOf": 0.01,
            "description": "COBOL PIC S9(9)V99 COMP-3"
          },
          "resp_hist_code": {
            "type": "string",
            "maxLength": 8
          }
        },
        "required": [
          "cr_account_balance",
          "cr_account_id",
          "cr_account_status",
          "cr_customer_id",
          "cr_customer_name",
          "cr_raw_data",
          "cr_security_group",
          "cr_segment_code",
          "cr_segment_payload",
          "req_account_id",
          "req_card_number",
          "req_channel",
          "req_customer_id",
          "req_filter_name",
          "req_filter_value",
          "req_include_history",
          "req_max_rows",
          "req_ssn",
          "req_timestamp",
          "req_trace_id",
          "resp_account_balance",
          "resp_customer_id",
          "resp_customer_name",
          "resp_hist_amount",
          "resp_hist_code",
          "resp_hist_date",
          "resp_history_count",
          "resp_message",
          "resp_status_code",
          "resp_trace_id",
          "ws_api_trace_id",
          "ws_counter",
          "ws_db2_customer_id",
          "ws_return_code",
          "ws_sqlcode"
        ],
        "x-cobol-note": "Draft generated from COBOL fields. Manual review required for REDEFINES, OCCURS DEPENDING ON, signed decimals, and binary fields."
      }
    }
  }
}