{
  "schemes": [
    "https"
  ],
  "swagger": "2.0",
  "info": {
    "description": "Asynchronous import and export jobs.",
    "title": "Job API",
    "contact": {},
    "version": "1.0.0"
  },
  "host": "api.catazenta.com",
  "basePath": "/",
  "paths": {
    "/v1/jobs": {
      "get": {
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "description": "Get a paginated list of jobs with optional filters",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "Jobs"
        ],
        "summary": "List jobs",
        "parameters": [
          {
            "minimum": 1,
            "type": "integer",
            "default": 1,
            "description": "Page number",
            "name": "page",
            "in": "query"
          },
          {
            "maximum": 100,
            "minimum": 1,
            "type": "integer",
            "default": 10,
            "description": "Items per page",
            "name": "page_size",
            "in": "query"
          },
          {
            "enum": [
              "product_import",
              "product_export",
              "category_import",
              "category_export"
            ],
            "type": "string",
            "description": "Filter by job type",
            "name": "type",
            "in": "query"
          },
          {
            "enum": [
              "pending",
              "processing",
              "completed",
              "failed",
              "cancelled"
            ],
            "type": "string",
            "description": "Filter by status",
            "name": "status",
            "in": "query"
          },
          {
            "type": "string",
            "description": "Filter by creator user ID",
            "name": "created_by",
            "in": "query"
          },
          {
            "type": "string",
            "description": "Search by name",
            "name": "search",
            "in": "query"
          },
          {
            "enum": [
              "export",
              "import"
            ],
            "type": "string",
            "description": "Filter by profile type",
            "name": "profile_type",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Jobs retrieved successfully",
            "schema": {
              "allOf": [
                {
                  "$ref": "#/definitions/response.PaginatedSuccessResponse"
                },
                {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/definitions/JobListResponse"
                    }
                  }
                }
              ]
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "500": {
            "description": "Internal server error",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          }
        }
      },
      "post": {
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "description": "Create a new import/export job",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "Jobs"
        ],
        "summary": "Create a job",
        "parameters": [
          {
            "description": "Job creation request",
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/CreateJobRequest"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Job created successfully",
            "schema": {
              "allOf": [
                {
                  "$ref": "#/definitions/response.SuccessResponse"
                },
                {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/definitions/JobResponse"
                    }
                  }
                }
              ]
            }
          },
          "400": {
            "description": "Bad request",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "500": {
            "description": "Internal server error",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          }
        }
      }
    },
    "/v1/jobs/bulk-delete": {
      "post": {
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "description": "Delete multiple jobs by IDs or all jobs (with optional exclusions)",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "Jobs"
        ],
        "summary": "Bulk delete jobs",
        "parameters": [
          {
            "description": "Bulk delete request",
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/BulkDeleteRequest"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bulk delete completed",
            "schema": {
              "allOf": [
                {
                  "$ref": "#/definitions/response.SuccessResponse"
                },
                {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/definitions/BulkDeleteResponse"
                    }
                  }
                }
              ]
            }
          },
          "400": {
            "description": "Bad request",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "500": {
            "description": "Internal server error",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          }
        }
      }
    },
    "/v1/jobs/download-url": {
      "post": {
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "description": "Generate an S3 presigned URL using a storage key from the request body",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "Jobs"
        ],
        "summary": "Generate a presigned download URL by storage key (POST)",
        "parameters": [
          {
            "description": "Download URL request",
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/GenerateDownloadURLRequest"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Download URL generated successfully",
            "schema": {
              "allOf": [
                {
                  "$ref": "#/definitions/response.SuccessResponse"
                },
                {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/definitions/GenerateDownloadURLResponse"
                    }
                  }
                }
              ]
            }
          },
          "400": {
            "description": "Bad request",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "500": {
            "description": "Internal server error",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          }
        }
      }
    },
    "/v1/jobs/upload-url": {
      "post": {
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "description": "Generate an S3 presigned URL for uploading a job input file",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "Jobs"
        ],
        "summary": "Generate a presigned upload URL",
        "parameters": [
          {
            "description": "Upload URL request",
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/GenerateUploadURLRequest"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Upload URL generated successfully",
            "schema": {
              "allOf": [
                {
                  "$ref": "#/definitions/response.SuccessResponse"
                },
                {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/definitions/GenerateUploadURLResponse"
                    }
                  }
                }
              ]
            }
          },
          "400": {
            "description": "Bad request",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "500": {
            "description": "Internal server error",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          }
        }
      }
    },
    "/v1/jobs/{id}": {
      "get": {
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "description": "Get job details by ID",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "Jobs"
        ],
        "summary": "Get a job",
        "parameters": [
          {
            "type": "string",
            "example": "0193a5b6-e7c0-7df0-b4b1-c0a1f5e3a8d1",
            "description": "Job ID",
            "name": "id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Job retrieved successfully",
            "schema": {
              "allOf": [
                {
                  "$ref": "#/definitions/response.SuccessResponse"
                },
                {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/definitions/JobResponse"
                    }
                  }
                }
              ]
            }
          },
          "400": {
            "description": "Bad request",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "404": {
            "description": "Not found",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          }
        }
      },
      "delete": {
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "description": "Soft-delete a job by ID",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "Jobs"
        ],
        "summary": "Delete a job",
        "parameters": [
          {
            "type": "string",
            "example": "0193a5b6-e7c0-7df0-b4b1-c0a1f5e3a8d1",
            "description": "Job ID",
            "name": "id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          },
          "400": {
            "description": "Bad request",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "500": {
            "description": "Internal server error",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          }
        }
      },
      "patch": {
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "description": "Partially update job fields (name, description, status)",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "Jobs"
        ],
        "summary": "Update a job",
        "parameters": [
          {
            "type": "string",
            "example": "0193a5b6-e7c0-7df0-b4b1-c0a1f5e3a8d1",
            "description": "Job ID",
            "name": "id",
            "in": "path",
            "required": true
          },
          {
            "description": "Job update request",
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/UpdateJobRequest"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Job updated successfully",
            "schema": {
              "allOf": [
                {
                  "$ref": "#/definitions/response.SuccessResponse"
                },
                {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/definitions/JobResponse"
                    }
                  }
                }
              ]
            }
          },
          "400": {
            "description": "Bad request",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "500": {
            "description": "Internal server error",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          }
        }
      }
    },
    "/v1/jobs/{id}/files/{type}": {
      "get": {
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "description": "Generate a presigned S3 download URL for a job file. Type must be: original, result, or error",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "Jobs"
        ],
        "summary": "Get a presigned file URL for a job",
        "parameters": [
          {
            "type": "string",
            "example": "0193a5b6-e7c0-7df0-b4b1-c0a1f5e3a8d1",
            "description": "Job ID",
            "name": "id",
            "in": "path",
            "required": true
          },
          {
            "enum": [
              "original",
              "result",
              "error"
            ],
            "type": "string",
            "description": "File type",
            "name": "type",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Download URL generated successfully",
            "schema": {
              "allOf": [
                {
                  "$ref": "#/definitions/response.SuccessResponse"
                },
                {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/definitions/GenerateDownloadURLResponse"
                    }
                  }
                }
              ]
            }
          },
          "400": {
            "description": "Bad request",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "404": {
            "description": "Not found",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "500": {
            "description": "Internal server error",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          }
        }
      }
    },
    "/v1/jobs/{id}/items": {
      "get": {
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "description": "Get paginated per-entity execution records for a specific job.",
        "produces": [
          "application/json"
        ],
        "tags": [
          "Jobs"
        ],
        "summary": "List job items",
        "parameters": [
          {
            "type": "string",
            "description": "Job ID",
            "name": "id",
            "in": "path",
            "required": true
          },
          {
            "type": "integer",
            "description": "Page number (default 1)",
            "name": "page",
            "in": "query"
          },
          {
            "type": "integer",
            "description": "Page size (default 20, max 100)",
            "name": "page_size",
            "in": "query"
          },
          {
            "type": "string",
            "description": "Comma-separated statuses: pending,processing,success,failed,skipped",
            "name": "status",
            "in": "query"
          },
          {
            "type": "string",
            "description": "Stage filter: extracted,transformed,validated,pushed",
            "name": "stage",
            "in": "query"
          },
          {
            "type": "string",
            "description": "Item type filter: product,variant,category,asset",
            "name": "item_type",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "allOf": [
                {
                  "$ref": "#/definitions/response.SuccessResponse"
                },
                {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/definitions/JobItemListResponse"
                    }
                  }
                }
              ]
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "500": {
            "description": "Internal Server Error",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          }
        }
      }
    },
    "/v1/jobs/{id}/steps": {
      "get": {
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "description": "Get all processing steps for a specific job",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "Jobs"
        ],
        "summary": "List job steps",
        "parameters": [
          {
            "type": "string",
            "example": "0193a5b6-e7c0-7df0-b4b1-c0a1f5e3a8d1",
            "description": "Job ID",
            "name": "id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Job steps retrieved successfully",
            "schema": {
              "allOf": [
                {
                  "$ref": "#/definitions/response.SuccessResponse"
                },
                {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/definitions/JobStepResponse"
                      }
                    }
                  }
                }
              ]
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "500": {
            "description": "Internal server error",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          }
        }
      }
    },
    "/v1/schedules": {
      "get": {
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "description": "Get a paginated list of schedules with optional filters",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "Schedules"
        ],
        "summary": "List schedules",
        "parameters": [
          {
            "minimum": 1,
            "type": "integer",
            "default": 1,
            "description": "Page number",
            "name": "page",
            "in": "query"
          },
          {
            "maximum": 100,
            "minimum": 1,
            "type": "integer",
            "default": 10,
            "description": "Items per page",
            "name": "page_size",
            "in": "query"
          },
          {
            "enum": [
              "export",
              "import"
            ],
            "type": "string",
            "description": "Filter by profile type",
            "name": "profile_type",
            "in": "query"
          },
          {
            "enum": [
              "active",
              "paused"
            ],
            "type": "string",
            "description": "Filter by status",
            "name": "status",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Schedules retrieved successfully",
            "schema": {
              "allOf": [
                {
                  "$ref": "#/definitions/response.PaginatedSuccessResponse"
                },
                {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/definitions/ScheduleListResponse"
                    }
                  }
                }
              ]
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "500": {
            "description": "Internal server error",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          }
        }
      },
      "post": {
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "description": "Create a new export/import schedule with a cron expression",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "Schedules"
        ],
        "summary": "Create a schedule",
        "parameters": [
          {
            "description": "Schedule creation request",
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/CreateScheduleRequest"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Schedule created successfully",
            "schema": {
              "allOf": [
                {
                  "$ref": "#/definitions/response.SuccessResponse"
                },
                {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/definitions/ScheduleResponse"
                    }
                  }
                }
              ]
            }
          },
          "400": {
            "description": "Bad request",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "500": {
            "description": "Internal server error",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          }
        }
      }
    },
    "/v1/schedules/{id}": {
      "get": {
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "description": "Get schedule details by ID",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "Schedules"
        ],
        "summary": "Get a schedule",
        "parameters": [
          {
            "type": "string",
            "example": "0193a5b6-e7c0-7df0-b4b1-c0a1f5e3a8d2",
            "description": "Schedule ID",
            "name": "id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Schedule retrieved successfully",
            "schema": {
              "allOf": [
                {
                  "$ref": "#/definitions/response.SuccessResponse"
                },
                {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/definitions/ScheduleResponse"
                    }
                  }
                }
              ]
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "404": {
            "description": "Not found",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          }
        }
      },
      "delete": {
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "description": "Delete a schedule by ID",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "Schedules"
        ],
        "summary": "Delete a schedule",
        "parameters": [
          {
            "type": "string",
            "example": "0193a5b6-e7c0-7df0-b4b1-c0a1f5e3a8d2",
            "description": "Schedule ID",
            "name": "id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "500": {
            "description": "Internal server error",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          }
        }
      },
      "patch": {
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "description": "Partially update schedule fields such as name, cron expression, or timezone",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "Schedules"
        ],
        "summary": "Update a schedule",
        "parameters": [
          {
            "type": "string",
            "example": "0193a5b6-e7c0-7df0-b4b1-c0a1f5e3a8d2",
            "description": "Schedule ID",
            "name": "id",
            "in": "path",
            "required": true
          },
          {
            "description": "Schedule update request",
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/UpdateScheduleRequest"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Schedule updated successfully",
            "schema": {
              "allOf": [
                {
                  "$ref": "#/definitions/response.SuccessResponse"
                },
                {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/definitions/ScheduleResponse"
                    }
                  }
                }
              ]
            }
          },
          "400": {
            "description": "Bad request",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "500": {
            "description": "Internal server error",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          }
        }
      }
    },
    "/v1/schedules/{id}/executions": {
      "get": {
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "description": "Get recent execution history for a schedule",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "Schedules"
        ],
        "summary": "List schedule executions",
        "parameters": [
          {
            "type": "string",
            "example": "0193a5b6-e7c0-7df0-b4b1-c0a1f5e3a8d2",
            "description": "Schedule ID",
            "name": "id",
            "in": "path",
            "required": true
          },
          {
            "type": "integer",
            "default": 20,
            "description": "Maximum number of results",
            "name": "limit",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Schedule executions retrieved successfully",
            "schema": {
              "allOf": [
                {
                  "$ref": "#/definitions/response.SuccessResponse"
                },
                {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/definitions/ScheduleExecutionResponse"
                      }
                    }
                  }
                }
              ]
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "500": {
            "description": "Internal server error",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          }
        }
      }
    },
    "/v1/schedules/{id}/status": {
      "patch": {
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "description": "Activate or pause a schedule",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "Schedules"
        ],
        "summary": "Update schedule status",
        "parameters": [
          {
            "type": "string",
            "example": "0193a5b6-e7c0-7df0-b4b1-c0a1f5e3a8d2",
            "description": "Schedule ID",
            "name": "id",
            "in": "path",
            "required": true
          },
          {
            "description": "Status update request",
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/UpdateScheduleStatusRequest"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Schedule status updated successfully",
            "schema": {
              "allOf": [
                {
                  "$ref": "#/definitions/response.SuccessResponse"
                },
                {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/definitions/ScheduleResponse"
                    }
                  }
                }
              ]
            }
          },
          "400": {
            "description": "Bad request",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          },
          "500": {
            "description": "Internal server error",
            "schema": {
              "$ref": "#/definitions/response.ErrorResponse"
            }
          }
        }
      }
    }
  },
  "definitions": {
    "response.Error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "field": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    },
    "response.ErrorResponse": {
      "type": "object",
      "properties": {
        "errors": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/response.Error"
          }
        },
        "message": {
          "type": "string"
        },
        "success": {
          "type": "boolean"
        }
      }
    },
    "response.PaginatedSuccessResponse": {
      "type": "object",
      "properties": {
        "data": {},
        "pagination": {
          "$ref": "#/definitions/response.PaginationInfo"
        },
        "success": {
          "type": "boolean"
        }
      }
    },
    "response.PaginationInfo": {
      "type": "object",
      "properties": {
        "has_next": {
          "type": "boolean"
        },
        "page": {
          "type": "integer"
        },
        "page_size": {
          "type": "integer"
        },
        "total_items": {
          "type": "integer"
        },
        "total_pages": {
          "type": "integer"
        }
      }
    },
    "response.SuccessResponse": {
      "type": "object",
      "properties": {
        "data": {},
        "success": {
          "type": "boolean"
        }
      }
    },
    "BulkDeleteRequest": {
      "type": "object",
      "properties": {
        "all": {
          "type": "boolean"
        },
        "exclude_ids": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "ids": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "BulkDeleteResponse": {
      "type": "object",
      "properties": {
        "deleted_count": {
          "type": "integer"
        },
        "deleted_ids": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "errors": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "failed_count": {
          "type": "integer"
        },
        "failed_ids": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "CreateJobRequest": {
      "type": "object",
      "required": [
        "type"
      ],
      "properties": {
        "connection_id": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "execution_mode": {
          "type": "string"
        },
        "handler_code": {
          "type": "string"
        },
        "idempotency_key": {
          "type": "string"
        },
        "info": {
          "type": "object",
          "additionalProperties": true
        },
        "name": {
          "type": "string"
        },
        "priority": {
          "type": "integer"
        },
        "profile_id": {
          "type": "string"
        },
        "profile_type": {
          "type": "string"
        },
        "storage_key": {
          "type": "string"
        },
        "type": {
          "type": "string"
        }
      }
    },
    "CreateScheduleRequest": {
      "type": "object",
      "required": [
        "cron_expression",
        "name",
        "profile_id",
        "profile_type"
      ],
      "properties": {
        "cron_expression": {
          "type": "string"
        },
        "execution_mode": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "profile_id": {
          "type": "string"
        },
        "profile_type": {
          "type": "string"
        },
        "timezone": {
          "type": "string"
        }
      }
    },
    "GenerateDownloadURLRequest": {
      "type": "object",
      "required": [
        "storage_key"
      ],
      "properties": {
        "expiry_minutes": {
          "type": "integer"
        },
        "storage_key": {
          "type": "string"
        }
      }
    },
    "GenerateDownloadURLResponse": {
      "type": "object",
      "properties": {
        "download_url": {
          "type": "string"
        },
        "expires_at": {
          "type": "string"
        },
        "storage_bucket": {
          "type": "string"
        },
        "storage_key": {
          "type": "string"
        }
      }
    },
    "GenerateUploadURLRequest": {
      "type": "object",
      "required": [
        "content_type",
        "file_name"
      ],
      "properties": {
        "content_type": {
          "type": "string"
        },
        "entity_type": {
          "type": "string"
        },
        "file_name": {
          "type": "string"
        },
        "file_size": {
          "type": "integer"
        }
      }
    },
    "GenerateUploadURLResponse": {
      "type": "object",
      "properties": {
        "expires_at": {
          "type": "string"
        },
        "storage_bucket": {
          "type": "string"
        },
        "storage_key": {
          "type": "string"
        },
        "upload_url": {
          "type": "string"
        }
      }
    },
    "JobItemListResponse": {
      "type": "object",
      "properties": {
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/JobItemResponse"
          }
        },
        "pagination": {
          "$ref": "#/definitions/PaginationInfo"
        }
      }
    },
    "JobItemResponse": {
      "type": "object",
      "properties": {
        "created_at": {
          "type": "string"
        },
        "entity_code": {
          "type": "string"
        },
        "entity_id": {
          "type": "string"
        },
        "errors": {
          "type": "object",
          "additionalProperties": true
        },
        "external_id": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "item_type": {
          "type": "string"
        },
        "job_id": {
          "type": "string"
        },
        "modified_at": {
          "type": "string"
        },
        "payload": {
          "type": "object",
          "additionalProperties": true
        },
        "processed_at": {
          "type": "string"
        },
        "response": {
          "type": "object",
          "additionalProperties": true
        },
        "retry_count": {
          "type": "integer"
        },
        "stage": {
          "type": "string"
        },
        "status": {
          "type": "string"
        },
        "tenant_id": {
          "type": "string"
        }
      }
    },
    "JobListItem": {
      "type": "object",
      "properties": {
        "connection_id": {
          "type": "string"
        },
        "created_at": {
          "type": "string"
        },
        "created_by": {
          "$ref": "#/definitions/UserSummary"
        },
        "error_storage_key": {
          "type": "string"
        },
        "execution_mode": {
          "type": "string"
        },
        "failure_count": {
          "type": "integer"
        },
        "handler_code": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "info": {
          "type": "object",
          "additionalProperties": true
        },
        "input_storage_key": {
          "type": "string"
        },
        "modified_at": {
          "type": "string"
        },
        "modified_by": {
          "$ref": "#/definitions/UserSummary"
        },
        "name": {
          "type": "string"
        },
        "output_storage_key": {
          "type": "string"
        },
        "priority": {
          "type": "integer"
        },
        "profile_id": {
          "type": "string"
        },
        "profile_type": {
          "type": "string"
        },
        "status": {
          "type": "string"
        },
        "success_count": {
          "type": "integer"
        },
        "tenant_id": {
          "type": "string"
        },
        "total_count": {
          "type": "integer"
        },
        "type": {
          "type": "string"
        }
      }
    },
    "JobListResponse": {
      "type": "object",
      "properties": {
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/JobListItem"
          }
        },
        "pagination": {
          "$ref": "#/definitions/PaginationInfo"
        }
      }
    },
    "JobResponse": {
      "type": "object",
      "properties": {
        "completed_at": {
          "type": "string"
        },
        "connection_id": {
          "type": "string"
        },
        "created_at": {
          "type": "string"
        },
        "created_by": {
          "$ref": "#/definitions/UserSummary"
        },
        "description": {
          "type": "string"
        },
        "error_storage_key": {
          "type": "string"
        },
        "execution_mode": {
          "type": "string"
        },
        "failure_count": {
          "type": "integer"
        },
        "handler_code": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "idempotency_key": {
          "type": "string"
        },
        "info": {
          "type": "object",
          "additionalProperties": true
        },
        "input_storage_key": {
          "type": "string"
        },
        "modified_at": {
          "type": "string"
        },
        "modified_by": {
          "$ref": "#/definitions/UserSummary"
        },
        "name": {
          "type": "string"
        },
        "output_storage_key": {
          "type": "string"
        },
        "priority": {
          "type": "integer"
        },
        "profile_id": {
          "type": "string"
        },
        "profile_type": {
          "type": "string"
        },
        "started_at": {
          "type": "string"
        },
        "status": {
          "type": "string"
        },
        "success_count": {
          "type": "integer"
        },
        "tenant_id": {
          "type": "string"
        },
        "total_count": {
          "type": "integer"
        },
        "type": {
          "type": "string"
        }
      }
    },
    "JobStepResponse": {
      "type": "object",
      "properties": {
        "completed_at": {
          "type": "string"
        },
        "created_at": {
          "type": "string"
        },
        "error_count": {
          "type": "integer"
        },
        "error_storage_key": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "job_id": {
          "type": "string"
        },
        "processed_count": {
          "type": "integer"
        },
        "retry_count": {
          "type": "integer"
        },
        "started_at": {
          "type": "string"
        },
        "status": {
          "type": "string"
        },
        "step_index": {
          "type": "integer"
        },
        "step_name": {
          "type": "string"
        },
        "step_type": {
          "type": "string"
        },
        "success_count": {
          "type": "integer"
        },
        "summary": {
          "type": "object",
          "additionalProperties": true
        },
        "total_count": {
          "type": "integer"
        },
        "warning_count": {
          "type": "integer"
        }
      }
    },
    "PaginationInfo": {
      "type": "object",
      "properties": {
        "has_next": {
          "type": "boolean"
        },
        "page": {
          "type": "integer"
        },
        "page_size": {
          "type": "integer"
        },
        "total_items": {
          "type": "integer"
        },
        "total_pages": {
          "type": "integer"
        }
      }
    },
    "ScheduleExecutionResponse": {
      "type": "object",
      "properties": {
        "completed_at": {
          "type": "string"
        },
        "error": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "job_id": {
          "type": "string"
        },
        "schedule_id": {
          "type": "string"
        },
        "status": {
          "type": "string"
        },
        "triggered_at": {
          "type": "string"
        }
      }
    },
    "ScheduleListResponse": {
      "type": "object",
      "properties": {
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/ScheduleResponse"
          }
        },
        "pagination": {
          "$ref": "#/definitions/PaginationInfo"
        }
      }
    },
    "ScheduleResponse": {
      "type": "object",
      "properties": {
        "created_at": {
          "type": "string"
        },
        "created_by": {
          "$ref": "#/definitions/UserSummary"
        },
        "cron_expression": {
          "type": "string"
        },
        "execution_mode": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "last_run_at": {
          "type": "string"
        },
        "modified_at": {
          "type": "string"
        },
        "modified_by": {
          "$ref": "#/definitions/UserSummary"
        },
        "name": {
          "type": "string"
        },
        "next_run_at": {
          "type": "string"
        },
        "profile_id": {
          "type": "string"
        },
        "profile_type": {
          "type": "string"
        },
        "status": {
          "type": "string"
        },
        "tenant_id": {
          "type": "string"
        },
        "timezone": {
          "type": "string"
        }
      }
    },
    "UpdateJobRequest": {
      "type": "object",
      "properties": {
        "description": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "status": {
          "type": "string"
        }
      }
    },
    "UpdateScheduleRequest": {
      "type": "object",
      "properties": {
        "cron_expression": {
          "type": "string"
        },
        "execution_mode": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "timezone": {
          "type": "string"
        }
      }
    },
    "UpdateScheduleStatusRequest": {
      "type": "object",
      "required": [
        "status"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "active",
            "paused"
          ]
        }
      }
    },
    "UserSummary": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      }
    }
  },
  "securityDefinitions": {
    "BearerAuth": {
      "type": "apiKey",
      "name": "Authorization",
      "in": "header"
    }
  }
}