{
    "swagger": "2.0",
    "info": {
        "contact": {}
    },
    "paths": {
        "/api/v1/workloads": {
            "get": {
                "description": "Lists all available workload (templates).",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "workload"
                ],
                "summary": "List Available Workloads",
                "operationId": "ListWorkloadTemplates",
                "parameters": [
                    {
                        "enum": [
                            "HTAP",
                            "OLTP",
                            "OLAP"
                        ],
                        "type": "string",
                        "description": "Workload type",
                        "name": "type",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "description": "Keyword to search in workload name or description",
                        "name": "keyword",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List of workloads",
                        "schema": {
                            "$ref": "#/definitions/dto.ListWorkloadResp"
                        }
                    },
                    "400": {
                        "description": "invalid config",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "500": {
                        "description": "Internal server error",
                        "schema": {
                            "type": "object"
                        }
                    }
                }
            }
        },
        "/api/v1/workloads/scripts": {
            "get": {
                "description": "Lists all available workload script with their phases.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "workload"
                ],
                "summary": "List Workload Script",
                "operationId": "ListWorkloadScripts",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Sort order for workload tests (e.g., createdAt)",
                        "name": "sort",
                        "in": "query"
                    },
                    {
                        "enum": [
                            "asc",
                            "desc"
                        ],
                        "type": "string",
                        "description": "Order by direction (asc or desc)",
                        "name": "orderBy",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "description": "Filter by workload test ID",
                        "name": "testID",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List of scripts",
                        "schema": {
                            "$ref": "#/definitions/dto.ListScriptResp"
                        }
                    },
                    "500": {
                        "description": "Internal server error",
                        "schema": {
                            "type": "object"
                        }
                    }
                }
            }
        },
        "/api/v1/workloads/scripts/templates": {
            "get": {
                "description": "Lists all available workload script templates with their phases, including message, startDuration, and mutation details.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "workload"
                ],
                "summary": "List Workload Script Templates",
                "operationId": "ListWorkloadScriptTemplates",
                "responses": {
                    "200": {
                        "description": "List of script templates",
                        "schema": {
                            "$ref": "#/definitions/dto.ListScriptTemplatesResp"
                        }
                    },
                    "500": {
                        "description": "Internal server error",
                        "schema": {
                            "type": "object"
                        }
                    }
                }
            }
        },
        "/api/v1/workloads/tests": {
            "get": {
                "description": "Lists all workload tests with optional filtering and sorting.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "workload"
                ],
                "summary": "List Workload Tests",
                "operationId": "ListWorkloadTests",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Sort order for workload tests (e.g., createdAt)",
                        "name": "sort",
                        "in": "query"
                    },
                    {
                        "enum": [
                            "asc",
                            "desc"
                        ],
                        "type": "string",
                        "description": "Order by direction (asc or desc)",
                        "name": "orderBy",
                        "in": "query"
                    },
                    {
                        "enum": [
                            "Created",
                            "Running",
                            "Succeeded",
                            "Failed",
                            "Canceled"
                        ],
                        "type": "string",
                        "description": "Filter by workload test status",
                        "name": "status",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List of workload tests",
                        "schema": {
                            "$ref": "#/definitions/dto.ListWorkloadTestResp"
                        }
                    },
                    "400": {
                        "description": "Invalid query parameters",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "500": {
                        "description": "Internal server error",
                        "schema": {
                            "type": "object"
                        }
                    }
                }
            },
            "post": {
                "description": "Runs a workload test with the provided configuration, this test will automatically process the cluster",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "workload"
                ],
                "summary": "Start Workload Test",
                "operationId": "RunWorkloadTest",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Bearer JWT token",
                        "name": "Authorization",
                        "in": "header",
                        "required": true
                    },
                    {
                        "description": "Workload test configuration",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/dto.RunWorkloadReq"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Workload test executed successfully",
                        "schema": {
                            "$ref": "#/definitions/dto.WorkloadTestResp"
                        }
                    },
                    "400": {
                        "description": "invalid config",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "401": {
                        "description": "unauthorized - missing or invalid JWT token",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "404": {
                        "description": "workload not found",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "500": {
                        "description": "internal server error",
                        "schema": {
                            "type": "object"
                        }
                    }
                }
            }
        },
        "/api/v1/workloads/tests/{id}": {
            "get": {
                "description": "Retrieves a workload test result by the ID.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "workload"
                ],
                "summary": "Get A Specific Test",
                "operationId": "GetWorkloadTest",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Workload Test ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Workload test result",
                        "schema": {
                            "$ref": "#/definitions/dto.WorkloadTestResp"
                        }
                    },
                    "400": {
                        "description": "Invalid ID parameter",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "404": {
                        "description": "Workload test not found",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "500": {
                        "description": "Internal server error",
                        "schema": {
                            "type": "object"
                        }
                    }
                }
            },
            "patch": {
                "security": [
                    {
                        "Bearer": []
                    }
                ],
                "description": "Updates the configuration of a workload test by the ID, including max connections and RU settings.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "workload"
                ],
                "summary": "Update Workload Test",
                "operationId": "UpdateWorkloadTest",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Workload Test ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Workload test configuration update request",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/dto.UpdateWorkloadTestReq"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Workload test updated successfully"
                    },
                    "400": {
                        "description": "Invalid query parameters",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "401": {
                        "description": "Unauthorized - missing or invalid JWT token",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "404": {
                        "description": "Workload test not found",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "500": {
                        "description": "Internal server error",
                        "schema": {
                            "type": "object"
                        }
                    }
                }
            }
        },
        "/api/v1/workloads/tests/{id}/audit": {
            "get": {
                "description": "Lists all audit logs for a workload test by ID.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "workload"
                ],
                "summary": "List Audit Logs",
                "operationId": "ListAuditLog",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Workload Test ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Audit logs retrieved successfully",
                        "schema": {
                            "$ref": "#/definitions/dto.ListAuditLogResp"
                        }
                    },
                    "400": {
                        "description": "Invalid ID parameter",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "404": {
                        "description": "Workload test not found",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "500": {
                        "description": "Internal server error",
                        "schema": {
                            "type": "object"
                        }
                    }
                }
            }
        },
        "/api/v1/workloads/tests/{id}/cluster": {
            "post": {
                "description": "Triggers cluster creation for a workload test by ID.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "workload"
                ],
                "summary": "Trigger Cluster Creation",
                "operationId": "TriggerCreateCluster",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Workload Test ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Cluster creation triggered successfully",
                        "schema": {
                            "$ref": "#/definitions/dto.WorkloadTestResp"
                        }
                    },
                    "400": {
                        "description": "Invalid ID parameter",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "401": {
                        "description": "unauthorized - missing or invalid JWT token",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "404": {
                        "description": "Workload test not found",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "500": {
                        "description": "Internal server error",
                        "schema": {
                            "type": "object"
                        }
                    }
                }
            }
        },
        "/api/v1/workloads/tests/{id}/cluster/ru": {
            "patch": {
                "security": [
                    {
                        "Bearer": []
                    }
                ],
                "description": "Updates the minimum and maximum RU settings for a cluster by the workload test ID.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "workload"
                ],
                "summary": "Update Cluster RU",
                "operationId": "UpdateClusterRU",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Workload Test ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Update cluster RU request",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/dto.UpdateClusterRUReq"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Cluster RU updated successfully"
                    },
                    "400": {
                        "description": "Invalid query parameters",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "500": {
                        "description": "Internal server error",
                        "schema": {
                            "type": "object"
                        }
                    }
                }
            }
        },
        "/api/v1/workloads/tests/{id}/cluster/scale": {
            "post": {
                "security": [
                    {
                        "Bearer": []
                    }
                ],
                "description": "Scales a cluster by the ID.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "workload"
                ],
                "summary": "Scale Cluster",
                "operationId": "ScaleCluster",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Workload Test ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Scale cluster request",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/dto.ScaleClusterReq"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Cluster scaled successfully"
                    },
                    "400": {
                        "description": "Invalid query parameters",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "500": {
                        "description": "Internal server error",
                        "schema": {
                            "type": "object"
                        }
                    }
                }
            }
        },
        "/api/v1/workloads/tests/{id}/conn": {
            "patch": {
                "security": [
                    {
                        "Bearer": []
                    }
                ],
                "description": "Updates the maximum connections for a workload test by the ID.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "workload"
                ],
                "summary": "Update Workload Test Max Connections",
                "operationId": "UpdateWorkloadTestMaxConn",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Workload Test ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Update max connections request",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/dto.UpdateWorkloadTestMaxConnReq"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Workload test max connections updated successfully"
                    },
                    "400": {
                        "description": "Invalid query parameters",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "500": {
                        "description": "Internal server error",
                        "schema": {
                            "type": "object"
                        }
                    }
                }
            }
        },
        "/api/v1/workloads/tests/{id}/failure": {
            "post": {
                "security": [
                    {
                        "Bearer": []
                    }
                ],
                "description": "Injects a failure into a cluster for a workload test by the ID with specified duration.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "workload"
                ],
                "summary": "Inject Failure",
                "operationId": "InjectFailure",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Workload Test ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Inject failure request",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/dto.InjectFailureReq"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "Failure injected successfully"
                    },
                    "400": {
                        "description": "Invalid query parameters",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "500": {
                        "description": "Internal server error",
                        "schema": {
                            "type": "object"
                        }
                    }
                }
            }
        },
        "/api/v1/workloads/tests/{id}/prepare": {
            "post": {
                "description": "Triggers data preparation for a workload test by ID.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "workload"
                ],
                "summary": "Trigger Data Preparation",
                "operationId": "TriggerPrepareData",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Workload Test ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Data preparation triggered successfully",
                        "schema": {
                            "$ref": "#/definitions/dto.WorkloadTestResp"
                        }
                    },
                    "400": {
                        "description": "Invalid ID parameter",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "401": {
                        "description": "unauthorized - missing or invalid JWT token",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "404": {
                        "description": "Workload test not found",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "500": {
                        "description": "Internal server error",
                        "schema": {
                            "type": "object"
                        }
                    }
                }
            }
        },
        "/api/v1/workloads/tests/{id}/reports/pdf": {
            "post": {
                "description": "Generates and downloads a PDF report for a workload test by ID. The report includes test configuration, performance metrics, and visualizations.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/pdf"
                ],
                "tags": [
                    "workload"
                ],
                "summary": "Download Test Report",
                "operationId": "DownloadTestReport",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Workload Test ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "PDF generation options",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/dto.DownloadTestReportReq"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "PDF report generated successfully"
                    },
                    "400": {
                        "description": "Invalid ID parameter or request body",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "401": {
                        "description": "unauthorized - missing or invalid JWT token",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "404": {
                        "description": "Workload test not found",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "500": {
                        "description": "Internal server error or PDF generation failed",
                        "schema": {
                            "type": "object"
                        }
                    }
                }
            }
        },
        "/api/v1/workloads/tests/{id}/sample/data": {
            "get": {
                "description": "Samples the data of a workload test by ID.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "workload"
                ],
                "summary": "Sample Workload Test Data",
                "operationId": "SampleWorkloadTestData",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Workload Test ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Sample data request",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/dto.SampleDataReq"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Data sample result",
                        "schema": {
                            "$ref": "#/definitions/dto.SampleDataResp"
                        }
                    },
                    "400": {
                        "description": "Invalid query parameters",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "404": {
                        "description": "Workload test not found",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "500": {
                        "description": "Internal server error",
                        "schema": {
                            "type": "object"
                        }
                    }
                }
            }
        },
        "/api/v1/workloads/tests/{id}/sample/db": {
            "get": {
                "description": "Samples the database of a workload test by ID.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "workload"
                ],
                "summary": "Sample Workload Test DB",
                "operationId": "SampleWorkloadTestDB",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Workload Test ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Sample DB request",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/dto.SampleDBReq"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Database sample result",
                        "schema": {
                            "$ref": "#/definitions/dto.SampleDBResp"
                        }
                    },
                    "400": {
                        "description": "Invalid query parameters",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "404": {
                        "description": "Workload test not found",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "500": {
                        "description": "Internal server error",
                        "schema": {
                            "type": "object"
                        }
                    }
                }
            }
        },
        "/api/v1/workloads/tests/{id}/scripts/{scriptId}": {
            "post": {
                "description": "Activates a script for a specific workload test.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "workload"
                ],
                "summary": "Activate Workload Script",
                "operationId": "ActivateWorkloadScript",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Test ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "Script ID",
                        "name": "scriptId",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Script activated successfully",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "400": {
                        "description": "Invalid parameters",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "500": {
                        "description": "Internal server error",
                        "schema": {
                            "type": "object"
                        }
                    }
                }
            }
        },
        "/api/v1/workloads/tests/{id}/stop": {
            "post": {
                "description": "Stops a running workload test by the ID.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "workload"
                ],
                "summary": "Stop Workload Test",
                "operationId": "StopWorkloadTest",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Workload Test ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Workload test stopped successfully",
                        "schema": {
                            "$ref": "#/definitions/dto.WorkloadTestResp"
                        }
                    },
                    "400": {
                        "description": "Invalid ID parameter",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "401": {
                        "description": "unauthorized - missing or invalid JWT token",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "404": {
                        "description": "Workload test not found",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "500": {
                        "description": "Internal server error",
                        "schema": {
                            "type": "object"
                        }
                    }
                }
            }
        },
        "/api/v1/workloads/tests/{id}/traffic": {
            "post": {
                "description": "Triggers traffic generation for a workload test by ID.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "workload"
                ],
                "summary": "Trigger Traffic Generation",
                "operationId": "TriggerRunTraffic",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Workload Test ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Traffic generation triggered successfully",
                        "schema": {
                            "$ref": "#/definitions/dto.WorkloadTestResp"
                        }
                    },
                    "400": {
                        "description": "Invalid ID parameter",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "401": {
                        "description": "unauthorized - missing or invalid JWT token",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "404": {
                        "description": "Workload test not found",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "500": {
                        "description": "Internal server error",
                        "schema": {
                            "type": "object"
                        }
                    }
                }
            }
        },
        "/api/v1/workloads/{id}": {
            "get": {
                "description": "Retrieves a workload template by the given ID, including usage statistics.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "workload"
                ],
                "summary": "Get Workload Template",
                "operationId": "GetWorkloadTemplate",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Workload ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Workload template retrieved successfully",
                        "schema": {
                            "$ref": "#/definitions/dto.WorkloadResp"
                        }
                    },
                    "400": {
                        "description": "Invalid ID parameter",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "404": {
                        "description": "Workload not found",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "500": {
                        "description": "Internal server error",
                        "schema": {
                            "type": "object"
                        }
                    }
                }
            }
        },
        "/api/v1/workloads/{id}/sample/data": {
            "get": {
                "description": "Retrieves the preserved sample data for a workload by workload ID.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "workload"
                ],
                "summary": "Get Preserved Sample Data",
                "operationId": "GetPreservedSampleWorkloadData",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Workload ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Sample data request",
                        "name": "request",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/dto.SampleDataReq"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Data sample result",
                        "schema": {
                            "$ref": "#/definitions/dto.SampleDataResp"
                        }
                    },
                    "400": {
                        "description": "Invalid query parameters",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "404": {
                        "description": "Workload not found",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "500": {
                        "description": "Internal server error",
                        "schema": {
                            "type": "object"
                        }
                    }
                }
            }
        },
        "/api/v1/workloads/{id}/sample/db": {
            "get": {
                "description": "Retrieves the preserved sample databases for a workload by workload ID.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "workload"
                ],
                "summary": "Get Preserved Sample Databases",
                "operationId": "GetPreservedSampleWorkloadDB",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Workload ID",
                        "name": "id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sample databases retrieved successfully",
                        "schema": {
                            "$ref": "#/definitions/dto.SampleDBResp"
                        }
                    },
                    "400": {
                        "description": "Invalid ID parameter",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "404": {
                        "description": "Workload not found",
                        "schema": {
                            "type": "object"
                        }
                    },
                    "500": {
                        "description": "Internal server error",
                        "schema": {
                            "type": "object"
                        }
                    }
                }
            }
        }
    },
    "definitions": {
        "constant.WorkloadParamName": {
            "type": "string",
            "enum": [
                "br_storage_url",
                "br_storage_url",
                "data_source",
                "duration",
                "max_connection_number",
                "min_ru",
                "max_ru",
                "thread",
                "client_cnt",
                "client_resource",
                "cluster_type",
                "workload_name",
                "sql_statement",
                "inject_failure",
                "rollback_failure"
            ],
            "x-enum-varnames": [
                "BrStorageURL",
                "ImportStorageURL",
                "DataSource",
                "Duration",
                "MaxConnectionNumber",
                "MinRU",
                "MaxRU",
                "Thread",
                "ClientCount",
                "ClientResource",
                "ClusterType",
                "WorkloadName",
                "SQLStatement",
                "InjectFailure",
                "RollbackFailure"
            ]
        },
        "dto.DownloadTestReportReq": {
            "type": "object",
            "properties": {
                "address": {
                    "type": "string"
                },
                "height": {
                    "type": "number"
                },
                "localStoragesJson": {
                    "type": "string"
                },
                "readySelector": {
                    "type": "string"
                },
                "width": {
                    "type": "number"
                }
            }
        },
        "dto.InjectFailureReq": {
            "type": "object",
            "properties": {
                "duration": {
                    "type": "string"
                }
            }
        },
        "dto.ListAuditLogResp": {
            "type": "object",
            "properties": {
                "auditLogs": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/model.AuditLog"
                    }
                },
                "page": {
                    "type": "integer"
                },
                "pageSize": {
                    "type": "integer"
                },
                "totalSize": {
                    "type": "integer"
                }
            }
        },
        "dto.ListScriptResp": {
            "type": "object",
            "properties": {
                "page": {
                    "type": "integer"
                },
                "pageSize": {
                    "type": "integer"
                },
                "scripts": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/dto.ScriptResp"
                    }
                },
                "totalSize": {
                    "type": "integer"
                }
            }
        },
        "dto.ListScriptTemplatesResp": {
            "type": "object",
            "properties": {
                "page": {
                    "type": "integer"
                },
                "pageSize": {
                    "type": "integer"
                },
                "templates": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/dto.ScriptTemplateResp"
                    }
                },
                "totalSize": {
                    "type": "integer"
                }
            }
        },
        "dto.ListWorkloadResp": {
            "type": "object",
            "properties": {
                "page": {
                    "type": "integer"
                },
                "pageSize": {
                    "type": "integer"
                },
                "totalSize": {
                    "type": "integer"
                },
                "workloads": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/dto.WorkloadResp"
                    }
                }
            }
        },
        "dto.ListWorkloadTestResp": {
            "type": "object",
            "properties": {
                "page": {
                    "type": "integer"
                },
                "pageSize": {
                    "type": "integer"
                },
                "tests": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/dto.WorkloadTestResp"
                    }
                },
                "totalSize": {
                    "type": "integer"
                }
            }
        },
        "dto.RunWorkloadReq": {
            "type": "object",
            "properties": {
                "isAuto": {
                    "type": "boolean"
                },
                "name": {
                    "type": "string"
                },
                "params": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/model.WorkloadParam"
                    }
                },
                "workloadID": {
                    "type": "integer"
                },
                "workloadName": {
                    "description": "@deprecated",
                    "type": "string"
                }
            }
        },
        "dto.SampleDBReq": {
            "type": "object",
            "properties": {
                "db_limit": {
                    "type": "integer"
                },
                "row_options": {
                    "$ref": "#/definitions/model.SampleDataOptions"
                },
                "table_limit": {
                    "type": "integer"
                },
                "with_data": {
                    "type": "boolean"
                }
            }
        },
        "dto.SampleDBResp": {
            "type": "object",
            "properties": {
                "databases": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/model.DataBase"
                    }
                },
                "db_count": {
                    "description": "StartTime   time.Time\nEndTime     time.Time\nExecuteTime float64",
                    "type": "integer"
                },
                "options": {
                    "$ref": "#/definitions/model.SampleDBOptions"
                },
                "version": {
                    "type": "integer"
                }
            }
        },
        "dto.SampleDataReq": {
            "type": "object",
            "properties": {
                "cutoff": {
                    "description": "SampleMethod SampleMethod `json:\"sample_method,omitempty\"` // Not supported now\nCutoff is the max lenght of the string",
                    "type": "integer"
                },
                "db_name": {
                    "type": "string"
                },
                "limit": {
                    "description": "Max rows per table",
                    "type": "integer"
                },
                "table_name": {
                    "type": "string"
                }
            }
        },
        "dto.SampleDataResp": {
            "type": "object",
            "properties": {
                "columns": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/model.Column"
                    }
                },
                "create_statement": {
                    "type": "string"
                },
                "error_message": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "options": {
                    "$ref": "#/definitions/model.SampleDataOptions"
                },
                "row_count": {
                    "description": "StartTime   time.Time\nEndTime     time.Time\nExecuteTime float64",
                    "type": "integer"
                },
                "rows": {
                    "type": "array",
                    "items": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                },
                "type": {
                    "type": "string"
                }
            }
        },
        "dto.ScaleClusterReq": {
            "type": "object",
            "properties": {
                "replicas": {
                    "type": "integer"
                }
            }
        },
        "dto.ScriptPhaseResp": {
            "type": "object",
            "properties": {
                "description": {
                    "type": "string"
                },
                "message": {
                    "type": "string"
                },
                "mutations": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/model.ScriptMutation"
                    }
                },
                "name": {
                    "type": "string"
                },
                "startDuration": {
                    "type": "integer",
                    "format": "int64"
                },
                "state": {
                    "type": "string"
                },
                "typeDetail": {
                    "$ref": "#/definitions/model.ScriptTypeDetail"
                }
            }
        },
        "dto.ScriptResp": {
            "type": "object",
            "properties": {
                "clusterType": {
                    "$ref": "#/definitions/model.ClusterType"
                },
                "createdAt": {
                    "type": "string"
                },
                "creatorEmail": {
                    "type": "string"
                },
                "description": {
                    "type": "string"
                },
                "id": {
                    "type": "integer"
                },
                "name": {
                    "type": "string"
                },
                "phases": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/dto.ScriptPhaseResp"
                    }
                },
                "templateId": {
                    "type": "integer"
                },
                "totalDuration": {
                    "type": "integer",
                    "format": "int64"
                },
                "updatedAt": {
                    "type": "string"
                },
                "workloadID": {
                    "type": "integer"
                },
                "workloadName": {
                    "type": "string"
                }
            }
        },
        "dto.ScriptTemplateResp": {
            "type": "object",
            "properties": {
                "createdAt": {
                    "type": "string"
                },
                "creatorEmail": {
                    "type": "string"
                },
                "description": {
                    "type": "string"
                },
                "id": {
                    "type": "integer"
                },
                "name": {
                    "type": "string"
                },
                "phases": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/dto.ScriptPhaseResp"
                    }
                },
                "totalDuration": {
                    "type": "integer",
                    "format": "int64"
                },
                "updatedAt": {
                    "type": "string"
                },
                "version": {
                    "type": "integer"
                }
            }
        },
        "dto.UpdateClusterRUReq": {
            "type": "object",
            "properties": {
                "maxRU": {
                    "type": "integer"
                },
                "minRU": {
                    "type": "integer"
                }
            }
        },
        "dto.UpdateWorkloadTestMaxConnReq": {
            "type": "object",
            "properties": {
                "maxConnectionNumber": {
                    "type": "integer"
                }
            }
        },
        "dto.UpdateWorkloadTestReq": {
            "type": "object",
            "properties": {
                "maxConnectionNumber": {
                    "type": "integer"
                },
                "maxRU": {
                    "type": "integer"
                },
                "minRU": {
                    "type": "integer"
                }
            }
        },
        "dto.WorkloadResp": {
            "type": "object",
            "properties": {
                "description": {
                    "type": "string"
                },
                "id": {
                    "type": "integer"
                },
                "name": {
                    "type": "string"
                },
                "paramsTemplate": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/model.WorkloadField"
                    }
                },
                "tags": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "testCount": {
                    "type": "integer"
                },
                "type": {
                    "$ref": "#/definitions/model.WorkloadType"
                }
            }
        },
        "dto.WorkloadTestResp": {
            "type": "object",
            "properties": {
                "cluster": {
                    "$ref": "#/definitions/model.TiDBCluster"
                },
                "createdAt": {
                    "type": "string"
                },
                "finishedAt": {
                    "type": "string"
                },
                "id": {
                    "description": "TODO: leave the database to generate the ID",
                    "type": "string"
                },
                "isAuto": {
                    "type": "boolean"
                },
                "message": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "params": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/model.WorkloadParam"
                    }
                },
                "phase": {
                    "$ref": "#/definitions/model.WorkloadTestPhase"
                },
                "progress": {
                    "description": "Progress is the ratio of completed tasks/total tasks",
                    "type": "number"
                },
                "startedAt": {
                    "type": "string"
                },
                "startedBy": {
                    "description": "User who started this workload test",
                    "type": "string"
                },
                "status": {
                    "$ref": "#/definitions/model.ExecStatus"
                },
                "tasks": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "ID": {
                                "description": "ID: leave the database to generate the ID",
                                "type": "integer"
                            },
                            "createdAt": {
                                "type": "string"
                            },
                            "estimatedDurationMin": {
                                "type": "integer"
                            },
                            "finishedAt": {
                                "type": "string"
                            },
                            "message": {
                                "type": "string"
                            },
                            "phase": {
                                "description": "Phase tracks the internal phase of the task for better recovery and concurrency control",
                                "allOf": [
                                    {
                                        "$ref": "#/definitions/model.WorkloadTaskPhase"
                                    }
                                ]
                            },
                            "progress": {
                                "type": "number"
                            },
                            "startedAt": {
                                "type": "string"
                            },
                            "status": {
                                "$ref": "#/definitions/model.ExecStatus"
                            },
                            "type": {
                                "description": "WorkloadID int64 `json:\"workloadID\"`",
                                "allOf": [
                                    {
                                        "$ref": "#/definitions/model.WorkloadTaskType"
                                    }
                                ]
                            },
                            "updatedAt": {
                                "type": "string"
                            }
                        }
                    }
                },
                "updatedAt": {
                    "type": "string"
                },
                "workloadID": {
                    "description": "Original fields from tcms workflow",
                    "type": "integer"
                },
                "workloadName": {
                    "type": "string"
                }
            }
        },
        "model.AuditLog": {
            "type": "object",
            "properties": {
                "detail": {
                    "description": "detail is formatted in json currently.",
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "objectId": {
                    "description": "Object ID is the object being operated, object type could be inferred\nfrom type.\nObject is the object users can feel, like workloadID/ workload test ID\nSo if a user triggers cluster scaling during a workload test, the object id should be the workload test ID\nmaybe add SubObjectID if needed.",
                    "type": "string"
                },
                "operateAt": {
                    "type": "string"
                },
                "operator": {
                    "description": "Operator Meta, the operator could be service or user...",
                    "allOf": [
                        {
                            "$ref": "#/definitions/model.OperatorMeta"
                        }
                    ]
                },
                "readableType": {
                    "description": "ReadableType is a readable string for the operate type",
                    "type": "string"
                },
                "type": {
                    "description": "Type should be unique between different object types.\nLike create_cluster and create_workload",
                    "allOf": [
                        {
                            "$ref": "#/definitions/model.OperateType"
                        }
                    ]
                }
            }
        },
        "model.ClusterType": {
            "type": "string",
            "enum": [
                "tidbcloud-premium",
                "tidbcloud-essential"
            ],
            "x-enum-varnames": [
                "ClusterTypeTiDBCloudPremium",
                "ClusterTypeTiDBCloudEssential"
            ]
        },
        "model.Column": {
            "type": "object",
            "properties": {
                "col": {
                    "type": "string"
                },
                "constraints": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/model.ColumnConstraint"
                    }
                },
                "data_type": {
                    "type": "string"
                },
                "default": {
                    "type": "string"
                },
                "extra": {
                    "type": "string"
                },
                "key": {
                    "type": "string"
                },
                "main_type": {
                    "type": "string"
                },
                "null": {
                    "type": "string"
                },
                "type_desc": {
                    "type": "string"
                }
            }
        },
        "model.ColumnConstraint": {
            "type": "object",
            "properties": {
                "column_name": {
                    "type": "string"
                },
                "constraint_name": {
                    "type": "string"
                },
                "ref_table_column_name": {
                    "type": "string"
                },
                "ref_table_name": {
                    "type": "string"
                }
            }
        },
        "model.DataBase": {
            "type": "object",
            "properties": {
                "error_message": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "tables": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/model.Table"
                    }
                }
            }
        },
        "model.ExecStatus": {
            "type": "string",
            "enum": [
                "pending",
                "running",
                "completed",
                "failed",
                "stopping",
                "stopped"
            ],
            "x-enum-varnames": [
                "ExecStatusPending",
                "ExecStatusRunning",
                "ExecStatusCompleted",
                "ExecStatusFailed",
                "ExecStatusStopping",
                "ExecStatusStopped"
            ]
        },
        "model.OperateType": {
            "type": "string",
            "enum": [
                "workload_create_test",
                "workload_stop_test",
                "workload_create_cluster",
                "workload_prepare_data",
                "workload_run_traffic",
                "workload_scale_cluster",
                "workload_config_traffic_connection",
                "workload_update_cluster_ru",
                "workload_inject_failure",
                "workload_rollback_failure",
                "workload_execute_sql",
                "workload_download_pdf",
                "workload_script_proceed"
            ],
            "x-enum-varnames": [
                "OperateTypeCreateWorkloadTest",
                "OperateTypeStopWorkloadTest",
                "OperateTypeCreateCluster",
                "OperateTypePrepareData",
                "OperateTypeRunTraffic",
                "OperateTypeScaleCluster",
                "OperateTypeConfigTrafficConn",
                "OperateTypeUpdateClusterRU",
                "OperateTypeInjectFailure",
                "OperateTypeRollbackFailure",
                "OperateTypeExecuteSQL",
                "OperateTypeDownloadWorkloadTestPDF",
                "OperateTypeProceed"
            ]
        },
        "model.OperatorMeta": {
            "type": "object",
            "properties": {
                "id": {
                    "type": "string"
                },
                "type": {
                    "$ref": "#/definitions/model.OperatorType"
                }
            }
        },
        "model.OperatorType": {
            "type": "string",
            "enum": [
                "service",
                "user"
            ],
            "x-enum-varnames": [
                "OperatorTypeService",
                "OperatorTypeUser"
            ]
        },
        "model.SampleDBOptions": {
            "type": "object",
            "properties": {
                "db_limit": {
                    "type": "integer"
                },
                "row_options": {
                    "$ref": "#/definitions/model.SampleDataOptions"
                },
                "table_limit": {
                    "type": "integer"
                },
                "with_data": {
                    "type": "boolean"
                }
            }
        },
        "model.SampleDataOptions": {
            "type": "object",
            "properties": {
                "cutoff": {
                    "description": "SampleMethod SampleMethod `json:\"sample_method,omitempty\"` // Not supported now\nCutoff is the max lenght of the string",
                    "type": "integer"
                },
                "db_name": {
                    "type": "string"
                },
                "limit": {
                    "description": "Max rows per table",
                    "type": "integer"
                },
                "table_name": {
                    "type": "string"
                }
            }
        },
        "model.ScriptMutation": {
            "type": "object",
            "properties": {
                "direction": {
                    "type": "string"
                },
                "param": {
                    "$ref": "#/definitions/constant.WorkloadParamName"
                },
                "toValue": {
                    "type": "string"
                }
            }
        },
        "model.ScriptPhaseType": {
            "type": "string",
            "enum": [
                "proceed",
                "mutate"
            ],
            "x-enum-varnames": [
                "ScriptPhaseTypeProceed",
                "ScriptPhaseTypeMutate"
            ]
        },
        "model.ScriptTypeDetail": {
            "type": "object",
            "properties": {
                "detail": {},
                "type": {
                    "$ref": "#/definitions/model.ScriptPhaseType"
                }
            }
        },
        "model.Table": {
            "type": "object",
            "properties": {
                "columns": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/model.Column"
                    }
                },
                "create_statement": {
                    "type": "string"
                },
                "error_message": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "rows": {
                    "type": "array",
                    "items": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                },
                "type": {
                    "type": "string"
                }
            }
        },
        "model.TiDBCluster": {
            "type": "object",
            "properties": {
                "clusterID": {
                    "type": "string"
                },
                "maxRU": {
                    "type": "integer"
                },
                "minRU": {
                    "type": "integer"
                },
                "orgID": {
                    "type": "string"
                },
                "projectID": {
                    "type": "string"
                },
                "type": {
                    "description": "TODO: Add the CloudRegion to the TiDBCluster struct\nCloudRegion string `json:\"cloudRegion,omitempty\" dbstore:\"cloudRegion\"`",
                    "allOf": [
                        {
                            "$ref": "#/definitions/model.ClusterType"
                        }
                    ]
                }
            }
        },
        "model.WorkloadField": {
            "type": "object",
            "properties": {
                "description": {
                    "type": "string"
                },
                "key": {
                    "type": "string"
                },
                "lowerLimit": {
                    "description": "INFO: string for now"
                },
                "name": {
                    "type": "string"
                },
                "options": {
                    "type": "array",
                    "items": {}
                },
                "required": {
                    "type": "boolean"
                },
                "type": {
                    "type": "string"
                },
                "upperLimit": {},
                "value": {
                    "description": "INFO: it's always string now. Maybe optimize to real type later"
                }
            }
        },
        "model.WorkloadParam": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string"
                },
                "value": {
                    "type": "string"
                }
            }
        },
        "model.WorkloadTaskPhase": {
            "type": "string",
            "enum": [
                "pending",
                "triggering",
                "running",
                "completed",
                "failed",
                "stopping",
                "stopped",
                "updating"
            ],
            "x-enum-comments": {
                "WorkloadTaskPhaseCompleted": "Task completed successfully",
                "WorkloadTaskPhaseFailed": "Task failed",
                "WorkloadTaskPhasePending": "Task created but not yet triggered",
                "WorkloadTaskPhaseRunning": "Polling external service for task status",
                "WorkloadTaskPhaseTriggering": "Calling external service to trigger the task",
                "WorkloadTaskPhaseUpdating": "under Updating task configuration, only viable for workload task now"
            },
            "x-enum-descriptions": [
                "Task created but not yet triggered",
                "Calling external service to trigger the task",
                "Polling external service for task status",
                "Task completed successfully",
                "Task failed",
                "under Updating task configuration, only viable for workload task now"
            ],
            "x-enum-varnames": [
                "WorkloadTaskPhasePending",
                "WorkloadTaskPhaseTriggering",
                "WorkloadTaskPhaseRunning",
                "WorkloadTaskPhaseCompleted",
                "WorkloadTaskPhaseFailed",
                "WorkloadTaskPhaseStopping",
                "WorkloadTaskPhaseStopped",
                "WorkloadTaskPhaseUpdating"
            ]
        },
        "model.WorkloadTaskType": {
            "type": "string",
            "enum": [
                "create_cluster",
                "prepare_data",
                "run_traffic"
            ],
            "x-enum-varnames": [
                "WorkloadTaskTypeCreateCluster",
                "WorkloadTaskTypePrepareData",
                "WorkloadTaskTypeRunTraffic"
            ]
        },
        "model.WorkloadTestPhase": {
            "type": "string",
            "enum": [
                "Pending",
                "Creating Cluster",
                "Preparing Data",
                "Running Workload",
                "Finished",
                ""
            ],
            "x-enum-varnames": [
                "WorkloadTestPhasePending",
                "WorkloadTestPhaseCreateCluster",
                "WorkloadTestPhasePrepareData",
                "WorkloadTestPhaseRunWorkload",
                "WorkloadTestPhaseFinished",
                "WorkloadTestPhaseDumb"
            ]
        },
        "model.WorkloadType": {
            "type": "string",
            "enum": [
                "HTAP",
                "OLTP",
                "OLAP"
            ],
            "x-enum-varnames": [
                "WorkloadTypeHTAP",
                "WorkloadTypeOLTP",
                "WorkloadTypeOLAP"
            ]
        }
    }
}