{
    "openapi": "3.0.0",
    "info": {
        "title": "PDF to CSV Conversion API",
        "description": "API for converting PDF bank statements to CSV format",
        "version": "1.0.0"
    },
    "paths": {
        "/api/bank-list": {
            "get": {
                "tags": [
                    "PDF Conversion"
                ],
                "summary": "Get Available Banks",
                "description": "Retrieve a list of active banks available for PDF conversion",
                "operationId": "e89460e7576cc5251353d4cb69c53f62",
                "responses": {
                    "200": {
                        "description": "Successfully retrieved bank list",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "code": {
                                            "type": "integer",
                                            "example": 200
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Bank list retrieved successfully"
                                        },
                                        "data": {
                                            "properties": {
                                                "banks": {
                                                    "type": "array",
                                                    "items": {
                                                        "properties": {
                                                            "bank_name": {
                                                                "type": "string",
                                                                "example": "BOB Bank"
                                                            },
                                                            "bank_id": {
                                                                "type": "integer",
                                                                "example": "1"
                                                            }
                                                        },
                                                        "type": "object"
                                                    }
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/pdf/convert": {
            "post": {
                "tags": [
                    "PDF Conversion"
                ],
                "summary": "Convert PDF to CSV",
                "description": "Upload a PDF file to initiate conversion to CSV format",
                "operationId": "ac05f9e72ef33463ec0449ecd4e1274b",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "upload_pdf",
                                    "bank_id"
                                ],
                                "properties": {
                                    "upload_pdf": {
                                        "description": "PDF file to convert (Max: 50MB)",
                                        "type": "string",
                                        "format": "binary"
                                    },
                                    "bank_id": {
                                        "description": "Bank identifier for parsing rules",
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "password": {
                                        "description": "If PDF contail password (Optional)",
                                        "type": "integer",
                                        "example": ""
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "File successfully sent for conversion",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "code": {
                                            "type": "integer",
                                            "example": 200
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "File sent for conversion"
                                        },
                                        "data": {
                                            "properties": {
                                                "batch_id": {
                                                    "type": "string",
                                                    "example": "550e8400-e29b-41d4-a716-446655440000"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized"
                    },
                    "422": {
                        "description": "Validation error"
                    },
                    "500": {
                        "description": "Server error"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/conversion/status": {
            "post": {
                "tags": [
                    "PDF Conversion"
                ],
                "summary": "Get PDF Conversion Status",
                "description": "Poll the status of a PDF to CSV conversion job using transaction_id or log_id",
                "operationId": "363f5cc8f3637ae151cf83000ce22baa",
                "parameters": [
                    {
                        "name": "batch_id",
                        "in": "query",
                        "description": "Unique Batch ID (UUID format)",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "uuid",
                            "example": ""
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Status retrieved successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "code": {
                                            "type": "integer",
                                            "example": 200
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Status retrieved successfully"
                                        },
                                        "data": {
                                            "properties": {
                                                "batch_id": {
                                                    "type": "string",
                                                    "format": "uuid",
                                                    "example": "550e8400-e29b-41d4-a716-446655440000"
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "pending",
                                                        "checking_password",
                                                        "password_required",
                                                        "processing",
                                                        "success",
                                                        "failed"
                                                    ],
                                                    "example": "success"
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "example": "Conversion completed successfully"
                                                },
                                                "progress": {
                                                    "type": "integer",
                                                    "maximum": 100,
                                                    "minimum": 0,
                                                    "example": 100
                                                },
                                                "transaction": {
                                                    "description": "Parsed CSV data as array of objects (present when status=completed)",
                                                    "type": "array",
                                                    "items": {
                                                        "properties": {
                                                            "Date": {
                                                                "type": "string",
                                                                "example": "2024-01-15"
                                                            },
                                                            "Description": {
                                                                "type": "string",
                                                                "example": "Grocery Store"
                                                            },
                                                            "Cheq No.": {
                                                                "type": "string",
                                                                "example": "123"
                                                            },
                                                            "Debit": {
                                                                "type": "string",
                                                                "example": "-45.99"
                                                            },
                                                            "Credit": {
                                                                "type": "string",
                                                                "example": "0"
                                                            },
                                                            "Balance": {
                                                                "type": "string",
                                                                "example": "1,234.56"
                                                            }
                                                        },
                                                        "type": "object"
                                                    },
                                                    "nullable": true
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized"
                    },
                    "422": {
                        "description": "Validation error"
                    },
                    "500": {
                        "description": "Server error"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        }
    },
    "components": {
        "responses": {
            "401": {
                "description": "Unauthorized - Invalid or missing API token",
                "content": {
                    "application/json": {
                        "schema": {
                            "properties": {
                                "success": {
                                    "type": "boolean",
                                    "example": false
                                },
                                "code": {
                                    "type": "integer",
                                    "example": 401
                                },
                                "message": {
                                    "type": "string",
                                    "example": "Invalid API Key"
                                },
                                "data": {
                                    "type": "object"
                                }
                            },
                            "type": "object"
                        }
                    }
                }
            },
            "500": {
                "description": "Internal server error",
                "content": {
                    "application/json": {
                        "schema": {
                            "properties": {
                                "success": {
                                    "type": "boolean",
                                    "example": false
                                },
                                "code": {
                                    "type": "integer",
                                    "example": 500
                                },
                                "message": {
                                    "type": "string",
                                    "example": "Internal server error occurred"
                                },
                                "data": {
                                    "type": "object"
                                }
                            },
                            "type": "object"
                        }
                    }
                }
            }
        },
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "bearerFormat": "JWT"
            }
        }
    },
    "tags": [
        {
            "name": "PDF Conversion",
            "description": "Endpoints for uploading, processing, and tracking PDF to CSV conversions"
        }
    ]
}