{
    "openapi": "3.0.0",
    "info": {
        "title": "Workflow API",
        "description": "REST API for managing configurable workflows, stages, applications, reports, and print templates.",
        "version": "1.0"
    },
    "servers": [
        {
            "url": "/workflow-api/api/v1",
            "description": "Workflow API v1"
        }
    ],
    "paths": {
        "/application/{workFlowId}/new": {
            "post": {
                "tags": [
                    "Application"
                ],
                "summary": "Submit a new workflow application request",
                "operationId": "7568cf17099779665110075e2f1b95b3",
                "parameters": [
                    {
                        "name": "workFlowId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "academicTermId": {
                                        "type": "integer"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Created request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/application": {
            "get": {
                "tags": [
                    "Application"
                ],
                "summary": "Get workflow requests for the current user",
                "operationId": "dafe9c9a27da0f25effd505851464acc",
                "parameters": [
                    {
                        "name": "userId",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "academicTermId",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "User requests with rule validation",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/application/{workFlowId}": {
            "get": {
                "tags": [
                    "Application"
                ],
                "summary": "Get requests for a specific workflow",
                "operationId": "bd8c73fa4a35c792cf5c49a93c24a7a2",
                "parameters": [
                    {
                        "name": "workFlowId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Workflow requests",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/application/{workFlowId}/{id}": {
            "get": {
                "tags": [
                    "Application"
                ],
                "summary": "Get a specific request by ID within a workflow",
                "operationId": "9a59b8ca52b4609b3a324307a50efb57",
                "parameters": [
                    {
                        "name": "workFlowId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Request details",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/application/{workFlowId}/{workFlowRequestId}/stages": {
            "get": {
                "tags": [
                    "Application"
                ],
                "summary": "Get all stages of a workflow application",
                "operationId": "c4d25ad73c8c6477f46f6486cdab4ff1",
                "parameters": [
                    {
                        "name": "workFlowId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "workFlowRequestId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Application stages with context",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/application/{workFlowId}/{workFlowRequestId}/stage/{id}": {
            "post": {
                "tags": [
                    "Application"
                ],
                "summary": "Save / submit a stage form",
                "operationId": "348f2e8c4fd22e1cc5a7fa6f30085c33",
                "parameters": [
                    {
                        "name": "workFlowId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "workFlowRequestId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "formData": {
                                        "description": "Base64-encoded JSON form data",
                                        "type": "string"
                                    },
                                    "status": {
                                        "type": "string"
                                    },
                                    "isDraft": {
                                        "type": "boolean"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Next stage info",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/application/manage/workflows/list": {
            "get": {
                "tags": [
                    "Application"
                ],
                "summary": "Get all active workflows for admin management",
                "description": "Permission: MANAGE_WORKFLOW",
                "operationId": "87a532869fa8521c8225bde503db4ccb",
                "parameters": [
                    {
                        "name": "userType",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Workflow list",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/application/manage/all/status": {
            "get": {
                "tags": [
                    "Application"
                ],
                "summary": "Get all applications with status for admin view",
                "description": "Permission: MANAGE_WORKFLOW",
                "operationId": "e158572349e9f6ed5b3df6437b0a46b0",
                "parameters": [
                    {
                        "name": "userType",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "workFlowId",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "stageId",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "applicantName",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "departmentId",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "batchId",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "applicationNumber",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "pageNumber",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "recordsPerPage",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "All applications",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/application/{stageId}/{key}/{workFlowRequestId}": {
            "get": {
                "tags": [
                    "Application"
                ],
                "summary": "Get the value of a specific form field for a workflow request",
                "operationId": "c5f99158ffb4435542bc425b6af6f948",
                "parameters": [
                    {
                        "name": "stageId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "key",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "workFlowRequestId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Field value",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/application/{workFlowRequestId}/{userStageId}": {
            "delete": {
                "tags": [
                    "Application"
                ],
                "summary": "Delete a user stage submission",
                "operationId": "32c5f64ea1d540ae4aaed2cf984f24cd",
                "parameters": [
                    {
                        "name": "workFlowRequestId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "userStageId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Stage deleted",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/application/check-status/{id}": {
            "post": {
                "tags": [
                    "Application"
                ],
                "summary": "Check payment status for a user stage payment",
                "operationId": "8a040b6ea295fdaaae9c643830cbb14b",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Payment status",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/application/payment/status/all": {
            "get": {
                "tags": [
                    "Application"
                ],
                "summary": "Get all payment statuses for the current user",
                "operationId": "d9af8a53d23e0fe3af1599e1681d82de",
                "parameters": [
                    {
                        "name": "workFlowRequestId",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Payment statuses",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/application/{workFlowRequestId}/stage/first": {
            "get": {
                "tags": [
                    "Application"
                ],
                "summary": "Get the first stage data for an applicant",
                "operationId": "8f2981b044e8746fe30affa2735ab41f",
                "parameters": [
                    {
                        "name": "workFlowRequestId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "First stage data",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/application/{workFlowRequestId}/print/pdf": {
            "get": {
                "tags": [
                    "Application"
                ],
                "summary": "Generate a PDF print of a workflow application",
                "operationId": "22c5391425f94ad6d14ceb0061a2cd48",
                "parameters": [
                    {
                        "name": "workFlowRequestId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Base64-encoded PDF",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/application/{workFlowRequestId}/stage/{stageId}/print/{printTemplateId}": {
            "get": {
                "tags": [
                    "Application"
                ],
                "summary": "Generate a PDF for a specific stage using a print template",
                "operationId": "1a156f8357da1b3a0b7fceafa63aebe5",
                "parameters": [
                    {
                        "name": "workFlowRequestId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "stageId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "printTemplateId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Base64-encoded PDF",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/application/{stageId}/approval/bulk/get": {
            "get": {
                "tags": [
                    "Application"
                ],
                "summary": "Get stage form data for bulk approval",
                "operationId": "eb5efb6a6b7f636c712547aa8ec03846",
                "parameters": [
                    {
                        "name": "stageId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Stage and empty form data",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/application/{stageId}/approval/bulk/save": {
            "post": {
                "tags": [
                    "Application"
                ],
                "summary": "Save a stage form for multiple applicants in bulk",
                "operationId": "91c5832efa0026dbe2cb29b3053ea778",
                "parameters": [
                    {
                        "name": "stageId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "userStageIds": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "formData": {
                                        "description": "Base64-encoded JSON form data",
                                        "type": "string"
                                    },
                                    "status": {
                                        "type": "string"
                                    },
                                    "isDraft": {
                                        "type": "boolean"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Bulk save result",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/application/manage/requests/all": {
            "get": {
                "tags": [
                    "Application"
                ],
                "summary": "Get all workflow requests for admin management",
                "description": "Permission: WORKFLOW_UPDATE_APPLICATION_STATUS",
                "operationId": "676e3943a52f4711dade2e967a38f625",
                "parameters": [
                    {
                        "name": "workFlowId",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "applicationNumber",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Admin workflow requests",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/application/manage/status/bulk": {
            "post": {
                "tags": [
                    "Application"
                ],
                "summary": "Bulk update the status of multiple workflow requests",
                "description": "Permission: WORKFLOW_UPDATE_APPLICATION_STATUS",
                "operationId": "bd520777029e008c18e089da724aeb0d",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "workFlowRequestIds": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "status": {
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Statuses updated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/application/{stageId}/{workFlowRequestId}/api": {
            "get": {
                "tags": [
                    "Application"
                ],
                "summary": "Get stage form data in API format (for external integrations)",
                "operationId": "52764c4cf2e035b97884c5ce29409b25",
                "parameters": [
                    {
                        "name": "stageId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "workFlowRequestId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "fieldsNeeded",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "description": "Base64-encoded JSON array of field keys",
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Stage data with headers",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/application/{workFlowId}/requests/user/status": {
            "get": {
                "tags": [
                    "Application"
                ],
                "summary": "Get applications of the current user by status",
                "operationId": "fdbbab7c1ef9f037e2b12b0b20e2752d",
                "parameters": [
                    {
                        "name": "workFlowId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "User applications with stage form data",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/application/webhook-payment-response": {
            "post": {
                "tags": [
                    "Application"
                ],
                "summary": "Process a webhook payment response",
                "operationId": "dd36782a3905e2d5f54d4376c6fa9d58",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "paymentResponse": {
                                        "description": "Encrypted payment response",
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Payment response processed",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/application/calculate/payment/student/{stageId}": {
            "get": {
                "tags": [
                    "Application"
                ],
                "summary": "Calculate the payment amount for a student stage",
                "operationId": "3349c399943ea7c5204734c5f7550f32",
                "parameters": [
                    {
                        "name": "stageId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "studentId",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "workFlowRequestId",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Calculated amount",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "number"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/application/{workFlowRequestId}/stage-summary": {
            "get": {
                "tags": [
                    "Application"
                ],
                "summary": "Get stage summary for a workflow request",
                "operationId": "93f68737eea1a59774e527f3965c1c19",
                "parameters": [
                    {
                        "name": "workFlowRequestId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Stage summary",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/category": {
            "get": {
                "tags": [
                    "Category"
                ],
                "summary": "Get all categories as a tree",
                "operationId": "ced84ac68a4c67c71dbb74ad5ca2d342",
                "responses": {
                    "200": {
                        "description": "Category tree",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Category"
                ],
                "summary": "Create a new category",
                "description": "Permission: CONFIGURE_WORKFLOW",
                "operationId": "4d7e99d550aec11bf0bb17a52930711c",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Category"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Created category ID",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/category/{id}": {
            "put": {
                "tags": [
                    "Category"
                ],
                "summary": "Update an existing category",
                "description": "Permission: CONFIGURE_WORKFLOW",
                "operationId": "37fff22b76b6aac3d023717585de5de8",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Category"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated category ID",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "Category"
                ],
                "summary": "Delete a category",
                "description": "Permission: CONFIGURE_WORKFLOW",
                "operationId": "a33380f98b2c751db5374c92e772a4bd",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Deletion confirmed",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/common/staffs": {
            "get": {
                "tags": [
                    "Common"
                ],
                "summary": "Get all staff details",
                "operationId": "09353e4e07854a455fc4a864821409c7",
                "responses": {
                    "200": {
                        "description": "List of staff",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/common/custom-field-value": {
            "get": {
                "tags": [
                    "Common"
                ],
                "summary": "Get the value of a custom workflow field",
                "operationId": "84dbc7a5fd212cee139c188295c3a4bb",
                "parameters": [
                    {
                        "name": "code",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "studentId",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "getValueAsList",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "boolean"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Custom field value",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/common/academic-terms": {
            "get": {
                "tags": [
                    "Common"
                ],
                "summary": "Get active academic terms and the current term",
                "operationId": "563c7f6ba087b14c93cf1b397ba4d61d",
                "responses": {
                    "200": {
                        "description": "Academic terms",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/common/get-attendance-percentage": {
            "get": {
                "tags": [
                    "Common"
                ],
                "summary": "Get subject-wise attendance percentage for a student",
                "operationId": "b127fb456277a0aa30fd3d7c74fbfbf5",
                "parameters": [
                    {
                        "name": "userId",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "academicTermId",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "workFlowId",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Attendance data",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/common/resource/{resourceId}/{responseType}": {
            "get": {
                "tags": [
                    "Common"
                ],
                "summary": "Get a pre-signed S3 URL for a resource",
                "operationId": "99b1ba5ab297d02f1b6002297900ced6",
                "parameters": [
                    {
                        "name": "resourceId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "responseType",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "view",
                                "download"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Pre-signed URL",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/common/get-attendance/daywise": {
            "get": {
                "tags": [
                    "Common"
                ],
                "summary": "Get day-wise attendance details for a student",
                "operationId": "c32e1a5a67375d3d8c4f39eecbc85eae",
                "parameters": [
                    {
                        "name": "userId",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Day-wise attendance",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "type": "object"
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/common/get-attendance/hourwise": {
            "get": {
                "tags": [
                    "Common"
                ],
                "summary": "Get hour-wise attendance details for a student",
                "operationId": "7ab54c8c538113c31841a5c6128c1f94",
                "parameters": [
                    {
                        "name": "userId",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Hour-wise attendance",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "type": "object"
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/common/departments": {
            "get": {
                "tags": [
                    "Common"
                ],
                "summary": "Get all departments",
                "operationId": "ccdae025667145938388cac022a7beaa",
                "responses": {
                    "200": {
                        "description": "List of departments",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "type": "object"
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/common/departments/{description}": {
            "get": {
                "tags": [
                    "Common"
                ],
                "summary": "Get departments with description as label",
                "operationId": "69c2e1c8c17d7d6b1f89324a5e62440f",
                "parameters": [
                    {
                        "name": "description",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List of departments",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "type": "object"
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/common/staffs/forms": {
            "get": {
                "tags": [
                    "Common"
                ],
                "summary": "Get all active staff for form dropdowns",
                "operationId": "10cc0fb58f048b8fc342a0af9c22eab4",
                "responses": {
                    "200": {
                        "description": "Staff list with label/value fields",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "type": "object"
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/common/batches": {
            "get": {
                "tags": [
                    "Common"
                ],
                "summary": "Get all batches",
                "operationId": "234891aafd7765f0aaf33dfa2c401abd",
                "parameters": [
                    {
                        "name": "deptId",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List of batches",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "type": "object"
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/common/years/{noOfPreviousYears}/forms": {
            "get": {
                "tags": [
                    "Common"
                ],
                "summary": "Get a list of years for form year-picker dropdowns",
                "operationId": "f6f63929799f9a65c8f05ed22115c27f",
                "parameters": [
                    {
                        "name": "noOfPreviousYears",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "example": 5
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List of years",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "type": "object"
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/common/applications/count": {
            "get": {
                "tags": [
                    "Common"
                ],
                "summary": "Get total count of workflow applications for a user",
                "operationId": "a681e907eb2d6ac48d3c922e539a3db6",
                "parameters": [
                    {
                        "name": "userType",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "STAFF",
                                "STUDENT"
                            ]
                        }
                    },
                    {
                        "name": "userId",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "workFlowId",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Application count",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "integer"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/common/academic-terms/all": {
            "get": {
                "tags": [
                    "Common"
                ],
                "summary": "Get all active academic terms with label field",
                "operationId": "7433b915305e89766f90e4b4d120221c",
                "responses": {
                    "200": {
                        "description": "Academic terms list",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "type": "object"
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/common/programmes": {
            "get": {
                "tags": [
                    "Common"
                ],
                "summary": "Get all programmes",
                "operationId": "8ac5c33dcf9e2fac47c0d89de06baa84",
                "responses": {
                    "200": {
                        "description": "List of programmes",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "type": "object"
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/common/bus": {
            "get": {
                "tags": [
                    "Common"
                ],
                "summary": "Get all bus names",
                "operationId": "15f1b8ff7f6cd7a77cb8f624877285af",
                "responses": {
                    "200": {
                        "description": "List of bus names",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "type": "object"
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/common/bus/routes": {
            "get": {
                "tags": [
                    "Common"
                ],
                "summary": "Get all bus routes",
                "operationId": "c7082a5b3291c20fab7d57beffcc2111",
                "responses": {
                    "200": {
                        "description": "List of bus routes",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "type": "object"
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/common/bus/boarding-points": {
            "get": {
                "tags": [
                    "Common"
                ],
                "summary": "Get boarding points for a bus route",
                "operationId": "0496e2b8d050a2c91b5c330db4e8cf2e",
                "parameters": [
                    {
                        "name": "busRouteId",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List of boarding points",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "type": "object"
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/common/schools": {
            "get": {
                "tags": [
                    "Common"
                ],
                "summary": "Get all schools for form dropdowns",
                "operationId": "6decb07a71926a5294c235e1af071791",
                "responses": {
                    "200": {
                        "description": "List of schools",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "type": "object"
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/print-template": {
            "get": {
                "tags": [
                    "PrintTemplate"
                ],
                "summary": "Get all active print templates (legacy global list)",
                "operationId": "fe3649a9de5ceaa42323e1ef1e8c3dda",
                "responses": {
                    "200": {
                        "description": "List of print templates",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "PrintTemplate"
                ],
                "summary": "Create a new authored (HTML) print template",
                "description": "Permission: AUTHOR_PRINT_TEMPLATE",
                "operationId": "e13bedf962514eab3a4af47960ca2849",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "name",
                                    "content",
                                    "workflowId"
                                ],
                                "properties": {
                                    "name": {
                                        "type": "string"
                                    },
                                    "description": {
                                        "type": "string"
                                    },
                                    "content": {
                                        "description": "HTML template content",
                                        "type": "string"
                                    },
                                    "workflowId": {
                                        "type": "string"
                                    },
                                    "stageId": {
                                        "nullable": true,
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Created template ID",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/print-template/workflow/{workflowId}": {
            "get": {
                "tags": [
                    "PrintTemplate"
                ],
                "summary": "Get print templates scoped to a workflow",
                "description": "Without ?stageId returns all templates for the workflow; with ?stageId returns only templates owned by that stage.",
                "operationId": "1c40e1a0eca2a4e2d25eff5f2c4defda",
                "parameters": [
                    {
                        "name": "workflowId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "stageId",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List of templates",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/print-template/workflow/{workflowId}/tokens": {
            "get": {
                "tags": [
                    "PrintTemplate"
                ],
                "summary": "Get the insert-field token catalog for a workflow",
                "operationId": "8edef54e9366c0cdf0af7ca0b0067653",
                "parameters": [
                    {
                        "name": "workflowId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Token catalog grouped by stage",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/print-template/{id}": {
            "get": {
                "tags": [
                    "PrintTemplate"
                ],
                "summary": "Get a single print template by ID (including HTML content)",
                "operationId": "213529c75bc506e31914fcc342302c0b",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Print template with content",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "put": {
                "tags": [
                    "PrintTemplate"
                ],
                "summary": "Update an existing authored print template",
                "description": "Permission: AUTHOR_PRINT_TEMPLATE",
                "operationId": "cd1a908f71bae29d456f98776d1ee649",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "name": {
                                        "type": "string"
                                    },
                                    "description": {
                                        "type": "string"
                                    },
                                    "content": {
                                        "type": "string"
                                    },
                                    "workflowId": {
                                        "type": "string"
                                    },
                                    "stageId": {
                                        "nullable": true,
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated template ID",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "delete": {
                "tags": [
                    "PrintTemplate"
                ],
                "summary": "Soft-delete an authored print template",
                "description": "Permission: AUTHOR_PRINT_TEMPLATE. Sets is_active = 0. File-based legacy templates are protected.",
                "operationId": "1a2a6694e49c2469f49aef0c1da7c2b5",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Deletion confirmed",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/print-template/preview": {
            "post": {
                "tags": [
                    "PrintTemplate"
                ],
                "summary": "Preview a draft print template as PDF",
                "description": "Permission: AUTHOR_PRINT_TEMPLATE. Returns base64-encoded PDF.",
                "operationId": "50f0e541b4368e58a5db0c8abf7f6020",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "content",
                                    "workflowId"
                                ],
                                "properties": {
                                    "content": {
                                        "description": "Base64-encoded HTML template",
                                        "type": "string"
                                    },
                                    "workflowId": {
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Base64 PDF",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/report": {
            "get": {
                "tags": [
                    "Report"
                ],
                "summary": "Get all custom reports",
                "description": "Permission: WORKFLOW_REPORT_MENUS",
                "operationId": "6b4121222589e238fc98610e95f1e8a1",
                "parameters": [
                    {
                        "name": "isActive",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "enum": [
                                0,
                                1
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List of reports",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Report"
                ],
                "summary": "Create a custom report",
                "description": "Permission: WORKFLOW_REPORT_CREATE",
                "operationId": "feb0b016a8f1ddc2541fdbec5cc6c291",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CustomReport"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Created report",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/report/{id}": {
            "get": {
                "tags": [
                    "Report"
                ],
                "summary": "Get report data for a custom report",
                "description": "Permission: WORKFLOW_REPORT_VIEW",
                "operationId": "719283742495cd7d09a7d80bfe87e2d2",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "filters",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "description": "JSON-encoded filters",
                            "type": "string"
                        }
                    },
                    {
                        "name": "isExport",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "enum": [
                                0,
                                1
                            ]
                        }
                    },
                    {
                        "name": "fileType",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Report data",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "put": {
                "tags": [
                    "Report"
                ],
                "summary": "Update a custom report",
                "description": "Permission: WORKFLOW_REPORT_CREATE",
                "operationId": "5d47d938b8d03331c17e174ef83427cf",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CustomReport"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated report",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/report/payment-requests/all": {
            "get": {
                "tags": [
                    "Report"
                ],
                "summary": "Get all payment requests across workflows",
                "description": "Permission: WORKFLOW_REPORT_VIEW",
                "operationId": "c783c7b3d8aa6567dfaf9e6e3d939620",
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        }
                    },
                    {
                        "name": "workFlowRequestStatus",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List of payment requests",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/stage/{workFlowId}": {
            "get": {
                "tags": [
                    "Stage"
                ],
                "summary": "Get stages for a specific workflow",
                "operationId": "6c5083e54d67b484c178735f6d78141b",
                "parameters": [
                    {
                        "name": "workFlowId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List of stages",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Stage"
                ],
                "summary": "Create a new stage within a workflow",
                "description": "Permission: CONFIGURE_WORKFLOW or CREATE_WORKFLOW",
                "operationId": "3513611de27be23b4807c82f24330a10",
                "parameters": [
                    {
                        "name": "workFlowId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WorkFlowStage"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Created stage",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/stage/{workFlowId}/{id}": {
            "put": {
                "tags": [
                    "Stage"
                ],
                "summary": "Update an existing stage",
                "description": "Permission: CONFIGURE_WORKFLOW or CREATE_WORKFLOW",
                "operationId": "5500dea30ac996473017ce9edc014ab4",
                "parameters": [
                    {
                        "name": "workFlowId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WorkFlowStage"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated stage",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/stage": {
            "get": {
                "tags": [
                    "Stage"
                ],
                "summary": "Search / list stages",
                "operationId": "6dbd7cce69af73e0cb41cb5b8ee97185",
                "parameters": [
                    {
                        "name": "id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "workFlowId",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "order",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "includeUserRequests",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "boolean"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List of stages",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/stage/order": {
            "put": {
                "tags": [
                    "Stage"
                ],
                "summary": "Reorder stages (bulk order update)",
                "description": "Permission: CONFIGURE_WORKFLOW or CREATE_WORKFLOW",
                "operationId": "5d7259d1ad855419861c0a16f4153857",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "array",
                                "items": {
                                    "properties": {
                                        "id": {
                                            "type": "string"
                                        },
                                        "order": {
                                            "type": "integer"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Order updated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/stage/{id}/rule": {
            "patch": {
                "tags": [
                    "Stage"
                ],
                "summary": "Update the approval rule of a stage",
                "description": "Permission: WORKFLOW_ASSIGN_STAFF",
                "operationId": "1155171572b849a7bf1682d2d91ca38c",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "description": "Approval rule JSON",
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Approval rule updated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/stage/rule/staff-types/all": {
            "get": {
                "tags": [
                    "Stage"
                ],
                "summary": "Get all available approval staff types (rule options)",
                "operationId": "3827ddf075e81976e2afde3275c337d9",
                "responses": {
                    "200": {
                        "description": "List of approval staff types",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/stage/sms-email-body/staff/{id}": {
            "put": {
                "tags": [
                    "Stage"
                ],
                "summary": "Update the SMS/email notification body for a stage",
                "description": "Permission: CONFIGURE_WORKFLOW or CREATE_WORKFLOW",
                "operationId": "ec4d905f8f8caf98c2afc311388ccd51",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "description": "SMS/email body object",
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "SMS/email body updated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/stage/rule/amount/payment": {
            "get": {
                "tags": [
                    "Stage"
                ],
                "summary": "Get all payment amount rules",
                "description": "Permission: CONFIGURE_WORKFLOW or CREATE_WORKFLOW",
                "operationId": "2971390bb017bf7ef0ad571b7ad2f30c",
                "responses": {
                    "200": {
                        "description": "List of amount rules",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/stage/{stageId}/print-buttons": {
            "patch": {
                "tags": [
                    "Stage"
                ],
                "summary": "Update the print buttons for a stage",
                "description": "Permission: AUTHOR_PRINT_TEMPLATE. Updates only the printButtons array inside the stage rule JSON.",
                "operationId": "60d820b6861dc8cc63ff12891e4fe75f",
                "parameters": [
                    {
                        "name": "stageId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "printButtons": {
                                        "type": "array",
                                        "items": {
                                            "type": "object"
                                        }
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Print buttons updated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/stage/rule/amount/payment/{operandId}": {
            "get": {
                "tags": [
                    "Stage"
                ],
                "summary": "Get lookup values for a payment amount rule operand",
                "operationId": "13a9785f716fbed488a65757b03a1c6e",
                "parameters": [
                    {
                        "name": "operandId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Lookup options",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/workflow": {
            "get": {
                "tags": [
                    "Workflow"
                ],
                "summary": "Search / list workflows",
                "operationId": "4828819b262cc3b0bace16c1a3b0a55c",
                "parameters": [
                    {
                        "name": "id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "name",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "isActive",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "includeStages",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "categoryId",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List of workflows",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "tags": [
                    "Workflow"
                ],
                "summary": "Create a new workflow",
                "description": "Permission: CONFIGURE_WORKFLOW or CREATE_WORKFLOW",
                "operationId": "3513a443f715268625526ce8695919e4",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WorkFlow"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Created workflow",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/workflow/{id}": {
            "get": {
                "tags": [
                    "Workflow"
                ],
                "summary": "Get a single workflow by ID",
                "operationId": "4a946746f2ae7f1761c2571eb1535cfd",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Workflow object",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "put": {
                "tags": [
                    "Workflow"
                ],
                "summary": "Update an existing workflow",
                "description": "Permission: CONFIGURE_WORKFLOW or CREATE_WORKFLOW",
                "operationId": "da04dc89adb506343ff73fb28502fe6f",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WorkFlow"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated workflow",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/workflow/{id}/print-template": {
            "patch": {
                "tags": [
                    "Workflow"
                ],
                "summary": "Update the print template assigned to a workflow",
                "description": "Permission: CONFIGURE_WORKFLOW",
                "operationId": "5eaeced7e01df8321cb307c0ee723d21",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "printTemplateId": {
                                        "type": "integer",
                                        "example": 1
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Print template updated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/workflow/{id}/{isActive}": {
            "patch": {
                "tags": [
                    "Workflow"
                ],
                "summary": "Publish or unpublish a workflow",
                "description": "Permission: CONFIGURE_WORKFLOW. isActive = 1 to publish, 0 to unpublish.",
                "operationId": "974445b5a1827c8c044c1951f3a9d21b",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "isActive",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer",
                            "enum": [
                                0,
                                1
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Publish state updated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/workflow/{id}/rule": {
            "put": {
                "tags": [
                    "Workflow"
                ],
                "summary": "Update the eligibility rule of a workflow",
                "description": "Permission: CONFIGURE_WORKFLOW",
                "operationId": "3763098fd8c75547f4dd75ab1cddff90",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "description": "Rule JSON object",
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Rule updated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/workflow/rule/{id}/permissions": {
            "put": {
                "tags": [
                    "Workflow"
                ],
                "summary": "Update user permission rule for a workflow",
                "description": "Permission: CONFIGURE_WORKFLOW",
                "operationId": "99dacc976c2cc3e3ebedc1d3239a5e97",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "description": "User rule JSON",
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "User rule updated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/workflow/rule/all": {
            "get": {
                "tags": [
                    "Workflow"
                ],
                "summary": "Get all available user/permission rules",
                "operationId": "30b155a7dc537718230fd8315770d0d8",
                "responses": {
                    "200": {
                        "description": "List of user rules",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/workflow/rule/{operandId}/other": {
            "get": {
                "tags": [
                    "Workflow"
                ],
                "summary": "Get lookup options for a rule operand (other-table values)",
                "operationId": "02a1886c0da465c09b09edb4be93526c",
                "parameters": [
                    {
                        "name": "operandId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Lookup options",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/workflow/sense/create": {
            "post": {
                "tags": [
                    "Workflow"
                ],
                "summary": "Create a workflow from a Sense (external) definition",
                "description": "Permission: CONFIGURE_WORKFLOW or CREATE_WORKFLOW",
                "operationId": "ba82b74cf2039361e28e52fca41ec9a0",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "workflow": {
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Workflow created",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/workflow/{id}/terms-conditions": {
            "put": {
                "tags": [
                    "Workflow"
                ],
                "summary": "Update the terms and conditions text of a workflow",
                "description": "Permission: CONFIGURE_WORKFLOW",
                "operationId": "034cfd5bb696395c44b88988c93d75c7",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "termsAndConditions": {
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Terms updated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/workflow/{id}/export": {
            "get": {
                "tags": [
                    "Workflow"
                ],
                "summary": "Export a workflow as a downloadable JSON file",
                "description": "Permission: CONFIGURE_WORKFLOW",
                "operationId": "2f3f184f0ce36a24bfa00b06df2adfc7",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "JSON file attachment",
                        "content": {
                            "application/json": {}
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/workflow/import": {
            "post": {
                "tags": [
                    "Workflow"
                ],
                "summary": "Import a workflow from a JSON payload",
                "description": "Permission: CONFIGURE_WORKFLOW or CREATE_WORKFLOW",
                "operationId": "7eeadf31d693af4e4f355e1033f9af6a",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "jsonData": {
                                        "description": "Stringified workflow JSON",
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Imported workflow",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiResponse"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        }
    },
    "components": {
        "schemas": {
            "Category": {
                "description": "A workflow category",
                "properties": {
                    "id": {
                        "description": "char(17) primary key",
                        "type": "string",
                        "example": "AbCdEfGhIjKlMnO12"
                    },
                    "name": {
                        "type": "string",
                        "example": "Finance"
                    },
                    "categoryId": {
                        "nullable": true,
                        "description": "Parent category char(17) ID for nested categories",
                        "type": "string"
                    },
                    "description": {
                        "nullable": true,
                        "type": "string"
                    },
                    "logo": {
                        "nullable": true,
                        "type": "string"
                    },
                    "color": {
                        "type": "string",
                        "example": "#007bff"
                    },
                    "sortOrder": {
                        "type": "integer",
                        "example": 0
                    },
                    "isActive": {
                        "description": "tinyint(1): 1=active, 0=inactive",
                        "type": "integer",
                        "example": 1
                    },
                    "children": {
                        "nullable": true,
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Category"
                        }
                    }
                },
                "type": "object"
            },
            "CustomReport": {
                "description": "A custom workflow report definition (wm_custom_reports)",
                "properties": {
                    "id": {
                        "description": "char(17) primary key",
                        "type": "string",
                        "example": "AbCdEfGhIjKlMnO12"
                    },
                    "name": {
                        "type": "string",
                        "example": "Monthly Fee Waiver Report"
                    },
                    "workFlowId": {
                        "nullable": true,
                        "description": "FK to wm_workflow.id (char(17))",
                        "type": "string"
                    },
                    "fragments": {
                        "nullable": true,
                        "description": "JSON with filters, fields, rawSql (wm_custom_reports.fragments)",
                        "type": "object"
                    },
                    "compiledFragments": {
                        "nullable": true,
                        "description": "Pre-compiled fragment cache (wm_custom_reports.compiled_fragments)",
                        "type": "object"
                    },
                    "isActive": {
                        "description": "int(11): 1=active, 0=inactive",
                        "type": "integer",
                        "example": 1
                    },
                    "extraDetails": {
                        "nullable": true,
                        "description": "JSON extra details; includes templateName key",
                        "type": "object"
                    },
                    "templateName": {
                        "description": "Resolved from extraDetails.templateName; defaults to 'table'",
                        "type": "string",
                        "example": "table"
                    },
                    "staffIds": {
                        "nullable": true,
                        "description": "Staff IDs with report access (populated from wm_custom_report_staff_permissions)",
                        "type": "array",
                        "items": {
                            "type": "integer"
                        }
                    },
                    "staffPermissions": {
                        "nullable": true,
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/CustomReportStaffPermission"
                        }
                    },
                    "type": {
                        "nullable": true,
                        "description": "Report descriptor; e.g. WORKFLOW or RAW_SQL",
                        "type": "string",
                        "example": "WORKFLOW"
                    }
                },
                "type": "object"
            },
            "CustomReportStaffPermission": {
                "description": "Staff permission entry for a custom report (wm_custom_report_staff_permissions)",
                "properties": {
                    "id": {
                        "description": "int AUTO_INCREMENT primary key",
                        "type": "integer",
                        "example": 1
                    },
                    "customReportId": {
                        "description": "FK to wm_custom_reports.id (char(17))",
                        "type": "string",
                        "example": "AbCdEfGhIjKlMnO12"
                    },
                    "staffId": {
                        "description": "FK to staffaccounts.staffID",
                        "type": "integer",
                        "example": 101
                    },
                    "createdBy": {
                        "nullable": true,
                        "type": "integer"
                    },
                    "createdDate": {
                        "nullable": true,
                        "type": "string",
                        "format": "date-time"
                    },
                    "updatedBy": {
                        "nullable": true,
                        "type": "integer"
                    },
                    "updatedDate": {
                        "nullable": true,
                        "type": "string",
                        "format": "date-time"
                    }
                },
                "type": "object"
            },
            "PrintTemplate": {
                "description": "A print template — Twig file-based or authored HTML (wm_print_templates)",
                "properties": {
                    "id": {
                        "description": "int AUTO_INCREMENT primary key",
                        "type": "integer",
                        "example": 1
                    },
                    "name": {
                        "type": "string",
                        "example": "Fee Receipt"
                    },
                    "fileKey": {
                        "nullable": true,
                        "description": "Twig filename without .twig extension; NULL for authored-HTML templates",
                        "type": "string",
                        "example": "fee_receipt"
                    },
                    "description": {
                        "nullable": true,
                        "type": "string"
                    },
                    "content": {
                        "nullable": true,
                        "description": "Raw HTML content for source_type=HTML templates (LONGTEXT)",
                        "type": "string"
                    },
                    "sourceType": {
                        "description": "FILE | HTML — determines whether file_key or content is used",
                        "type": "string",
                        "example": "FILE"
                    },
                    "workFlowId": {
                        "nullable": true,
                        "description": "Optional FK to wm_workflow.id (char(17)); workflow-scoped template",
                        "type": "string"
                    },
                    "workFlowStageId": {
                        "nullable": true,
                        "description": "Optional FK to wm_stages.id (char(17)); stage-scoped template",
                        "type": "string"
                    },
                    "isActive": {
                        "description": "tinyint(1): 1=active, 0=inactive",
                        "type": "integer",
                        "example": 1
                    }
                },
                "type": "object"
            },
            "UserStagePayment": {
                "description": "Payment record linked to a workflow user-stage (wm_user_stage_payments)",
                "properties": {
                    "id": {
                        "description": "char(17) primary key",
                        "type": "string",
                        "example": "AbCdEfGhIjKlMnO12"
                    },
                    "userStageId": {
                        "description": "FK to wm_user_stages.id (char(17))",
                        "type": "string",
                        "example": "AbCdEfGhIjKlMnO12"
                    },
                    "amount": {
                        "description": "Payment amount as integer (wm_user_stage_payments.amount)",
                        "type": "integer",
                        "example": 1000
                    },
                    "linwaysTxnId": {
                        "description": "Unique Linways transaction ID (varchar(100))",
                        "type": "string",
                        "example": "TXN123456"
                    },
                    "status": {
                        "description": "Payment status; default PENDING (varchar(100))",
                        "type": "string",
                        "example": "PENDING"
                    },
                    "studentId": {
                        "nullable": true,
                        "description": "Populated from join; not stored in wm_user_stage_payments",
                        "type": "integer"
                    },
                    "staffId": {
                        "nullable": true,
                        "description": "Populated from join; not stored in wm_user_stage_payments",
                        "type": "integer"
                    },
                    "studentName": {
                        "nullable": true,
                        "description": "Computed display name for student",
                        "type": "string"
                    },
                    "staffName": {
                        "nullable": true,
                        "description": "Computed display name for staff",
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "WorkFlow": {
                "description": "A workflow definition",
                "properties": {
                    "id": {
                        "description": "char(17) primary key",
                        "type": "string",
                        "example": "AbCdEfGhIjKlMnO12"
                    },
                    "name": {
                        "type": "string",
                        "example": "Fee Waiver Request"
                    },
                    "description": {
                        "nullable": true,
                        "type": "string",
                        "example": "Workflow for fee waiver processing"
                    },
                    "type": {
                        "description": "STAFF | STUDENT",
                        "type": "string",
                        "example": "STAFF"
                    },
                    "rule": {
                        "nullable": true,
                        "description": "JSON eligibility rule stored in wm_workflow.rule",
                        "type": "object"
                    },
                    "userRule": {
                        "nullable": true,
                        "description": "JSON user-eligibility rule stored in wm_workflow.user_rule",
                        "type": "object"
                    },
                    "isActive": {
                        "description": "tinyint(1): 1=active, 0=inactive",
                        "type": "integer",
                        "example": 1
                    },
                    "printTemplateId": {
                        "description": "FK to wm_print_templates.id",
                        "type": "integer",
                        "example": 1
                    },
                    "dynamicProperties": {
                        "nullable": true,
                        "description": "Free-form TEXT column for extra workflow properties",
                        "type": "string"
                    },
                    "categoryId": {
                        "nullable": true,
                        "description": "FK to wm_category.id (char(17))",
                        "type": "string"
                    },
                    "categoryName": {
                        "nullable": true,
                        "type": "string"
                    },
                    "categoryColor": {
                        "nullable": true,
                        "type": "string",
                        "example": "#007bff"
                    }
                },
                "type": "object"
            },
            "WorkFlowRule": {
                "description": "An eligibility or approval rule definition (wm_rules)",
                "properties": {
                    "id": {
                        "description": "char(17) primary key",
                        "type": "string",
                        "example": "AbCdEfGhIjKlMnO12"
                    },
                    "code": {
                        "description": "Unique rule code (varchar(100))",
                        "type": "string",
                        "example": "BATCH_START_YEAR"
                    },
                    "label": {
                        "description": "Human-readable label (varchar(100))",
                        "type": "string",
                        "example": "Batch Start Year"
                    },
                    "fieldName": {
                        "nullable": true,
                        "description": "DB/model field name (varchar(45))",
                        "type": "string",
                        "example": "batchStartYear"
                    },
                    "callFunction": {
                        "nullable": true,
                        "description": "JSON describing callable function for dynamic resolution",
                        "type": "object"
                    },
                    "baseTableName": {
                        "nullable": true,
                        "description": "Source table name (varchar(45))",
                        "type": "string"
                    },
                    "baseTablePrimaryKey": {
                        "nullable": true,
                        "description": "PK column of the base table (varchar(45))",
                        "type": "string"
                    },
                    "baseTableDisplayName": {
                        "nullable": true,
                        "description": "Display column of the base table (varchar(45))",
                        "type": "string"
                    },
                    "options": {
                        "nullable": true,
                        "description": "Pre-defined selectable options (JSON array)",
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "operators": {
                        "nullable": true,
                        "description": "Allowed comparison operators e.g. EQ, LT, GT",
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                },
                "type": "object"
            },
            "WorkFlowStage": {
                "description": "A stage within a workflow (wm_stages)",
                "properties": {
                    "id": {
                        "description": "char(17) primary key",
                        "type": "string",
                        "example": "AbCdEfGhIjKlMnO12"
                    },
                    "workFlowId": {
                        "description": "FK to wm_workflow.id (char(17))",
                        "type": "string",
                        "example": "AbCdEfGhIjKlMnO12"
                    },
                    "name": {
                        "type": "string",
                        "example": "Initial Review"
                    },
                    "description": {
                        "nullable": true,
                        "type": "string",
                        "example": "First stage of the workflow"
                    },
                    "order": {
                        "nullable": true,
                        "type": "integer",
                        "example": 1
                    },
                    "rule": {
                        "nullable": true,
                        "description": "JSON approval rule (wm_stages.rule)",
                        "type": "object"
                    },
                    "formSchema": {
                        "nullable": true,
                        "description": "JSON form schema (wm_stages.form_schema)",
                        "type": "object"
                    },
                    "simpleSchema": {
                        "nullable": true,
                        "description": "JSON simple schema (wm_stages.simple_schema)",
                        "type": "object"
                    },
                    "smsMailBody": {
                        "nullable": true,
                        "description": "SMS/mail notification body JSON (wm_stages.sms_mail_body)",
                        "type": "object"
                    },
                    "assignedStaffSmsMailBody": {
                        "nullable": true,
                        "description": "Notification body for assigned approver staff (wm_stages.assigned_staff_sms_mail_body)",
                        "type": "object"
                    },
                    "userStages": {
                        "nullable": true,
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    }
                },
                "type": "object"
            },
            "WorkFlowUserRequest": {
                "description": "A user's workflow application/request (wm_workflow_requests)",
                "properties": {
                    "id": {
                        "description": "char(17) primary key",
                        "type": "string",
                        "example": "AbCdEfGhIjKlMnO12"
                    },
                    "workFlowId": {
                        "description": "FK to wm_workflow.id (char(17))",
                        "type": "string",
                        "example": "AbCdEfGhIjKlMnO12"
                    },
                    "studentId": {
                        "nullable": true,
                        "description": "FK to studentaccount.studentID",
                        "type": "integer"
                    },
                    "staffId": {
                        "nullable": true,
                        "description": "FK to staffaccounts.staffID",
                        "type": "integer"
                    },
                    "status": {
                        "description": "Request status (wm_workflow_requests.status)",
                        "type": "string",
                        "example": "PENDING"
                    },
                    "applicationNumber": {
                        "nullable": true,
                        "description": "Auto-generated application number (wm_workflow_requests.application_number)",
                        "type": "string"
                    },
                    "otherModuleRemarks": {
                        "nullable": true,
                        "description": "Remarks from other modules (wm_workflow_requests.other_module_remarks)",
                        "type": "string"
                    },
                    "userName": {
                        "nullable": true,
                        "description": "Computed: applicant display name",
                        "type": "string",
                        "example": "John Doe"
                    },
                    "admissionNo": {
                        "nullable": true,
                        "type": "string"
                    },
                    "regNo": {
                        "nullable": true,
                        "type": "string"
                    },
                    "staffCode": {
                        "nullable": true,
                        "type": "string"
                    },
                    "batchName": {
                        "nullable": true,
                        "type": "string"
                    },
                    "deptName": {
                        "nullable": true,
                        "type": "string"
                    },
                    "userType": {
                        "description": "STAFF | STUDENT",
                        "type": "string",
                        "example": "STAFF"
                    },
                    "userStageId": {
                        "nullable": true,
                        "description": "char(17) ID of the current wm_user_stages record",
                        "type": "string"
                    },
                    "workFlowName": {
                        "nullable": true,
                        "type": "string"
                    },
                    "workFlowStageId": {
                        "nullable": true,
                        "description": "char(17) ID of the current stage",
                        "type": "string"
                    },
                    "workFlowStageName": {
                        "nullable": true,
                        "type": "string"
                    },
                    "workFlowIsActive": {
                        "nullable": true,
                        "description": "tinyint(1) is_active of the parent workflow",
                        "type": "integer"
                    },
                    "academicTermId": {
                        "nullable": true,
                        "type": "integer"
                    },
                    "printOnlyAfterApproval": {
                        "nullable": true,
                        "type": "boolean"
                    }
                },
                "type": "object"
            },
            "WorkFlowUserStage": {
                "description": "A user's progress record for a single workflow stage (wm_user_stages)",
                "properties": {
                    "id": {
                        "description": "char(17) primary key",
                        "type": "string",
                        "example": "AbCdEfGhIjKlMnO12"
                    },
                    "workFlowRequestId": {
                        "description": "FK to wm_workflow_requests.id (char(17))",
                        "type": "string",
                        "example": "AbCdEfGhIjKlMnO12"
                    },
                    "stageId": {
                        "description": "FK to wm_stages.id (char(17))",
                        "type": "string",
                        "example": "AbCdEfGhIjKlMnO12"
                    },
                    "formData": {
                        "nullable": true,
                        "description": "Submitted form data JSON (wm_user_stages.form_data)",
                        "type": "object"
                    },
                    "status": {
                        "description": "Stage status varchar(100)",
                        "type": "string",
                        "example": "PENDING"
                    },
                    "approvalHistory": {
                        "nullable": true,
                        "description": "JSON log of approval actions (wm_user_stages.approval_history)",
                        "type": "object"
                    },
                    "workFlowRequest": {
                        "nullable": true,
                        "description": "Populated parent WorkFlowUserRequest object (not stored)",
                        "type": "object"
                    }
                },
                "type": "object"
            },
            "ApiResponse": {
                "description": "Standard response envelope returned by all endpoints",
                "properties": {
                    "statusCode": {
                        "type": "integer",
                        "example": 200
                    },
                    "status": {
                        "type": "string",
                        "example": "success"
                    },
                    "message": {
                        "type": "string",
                        "example": ""
                    },
                    "result": {
                        "description": "Endpoint-specific payload"
                    }
                },
                "type": "object"
            }
        },
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "bearerFormat": "JWT",
                "scheme": "bearer"
            }
        }
    },
    "tags": [
        {
            "name": "Workflow",
            "description": "Workflow definition management"
        },
        {
            "name": "Stage",
            "description": "Workflow stage configuration"
        },
        {
            "name": "Application",
            "description": "User workflow applications (requests)"
        },
        {
            "name": "Category",
            "description": "Workflow category management"
        },
        {
            "name": "Report",
            "description": "Custom workflow reports"
        },
        {
            "name": "PrintTemplate",
            "description": "Print template authoring and management"
        },
        {
            "name": "Common",
            "description": "Shared lookup endpoints (staff, departments, etc.)"
        }
    ]
}