{
  "openapi": "3.0.1",
  "info": {
    "title": "Video Processing API",
    "description": "API for processing video clips from video URLs or YouTube URLs",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://mango.quickreel.io/api/v2"
    }
  ],
  "security": [
    {
      "apiKeyAuth": []
    }
  ],
  "paths": {
    "/subtitles": {
      "post": {
        "summary": "Request video processing",
        "description": "",
        "requestBody": {
          "description": "Request payload for video processing",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VideoRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Request created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request: Missing required fields",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: API key invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error: Please try again later or contact support",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InternalServerErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: Please slow down your request rate.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TooManyRequestsErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "VideoRequest": {
        "type": "object",
        "properties": {
          "videoUrl": {
            "type": "string",
            "description": "Video URL or YouTube URL",
            "example": "https://www.youtube.com/watch?v=eY4pgeNBhk4"
          },
          "language": {
            "type": "string",
            "description": "Preferred language for subtitles",
            "example": "english",
            "enum": [
              "bulgarian",
              "catalan",
              "chinese (mandarin, simplified)",
              "chinese (mandarin, traditional)",
              "czech",
              "danish",
              "dutch",
              "english",
              "estonian",
              "finnish",
              "flemish",
              "french",
              "german",
              "german (switzerland)",
              "greek",
              "hindi",
              "hungarian",
              "indonesian",
              "italian",
              "japanese",
              "korean",
              "latvian",
              "lithuanian",
              "malay",
              "multilingual (spanish + english)",
              "norwegian",
              "polish",
              "portuguese",
              "romanian",
              "russian",
              "slovak",
              "spanish",
              "swedish",
              "thai",
              "turkish",
              "ukrainian",
              "vietnamese"
            ]
          },
          "webhookUrl": {
            "type": "string",
            "description": "Webhook URL for receiving processing updates",
            "example": "https://webhook-test.com/05674b0b229c29199fec105309a00e16"
          },
          "subtitleStyles": {
            "type": "object",
            "properties": {
              "template": {
                "type": "string",
                "description": "Subtitle template style",
                "example": "productive",
                "default": "productive",
                "enum": [
                  "cinematic",
                  "vivid",
                  "whisperer2",
                  "harmozi",
                  "pulse",
                  "filler",
                  "whisperer",
                  "marineShift",
                  "sonic",
                  "spotlight",
                  "focusFlash",
                  "inflate",
                  "boxd",
                  "productive",
                  "beast",
                  "impact",
                  "fade",
                  "typewriter",
                  "impact2"
                ]
              },
              "position": {
                "type": "string",
                "description": "Position of subtitles on the video",
                "example": "bottom-center",
                "default": "bottom-center",
                "enum": ["bottom-center", "top-center", "middle-center"]
              },
              "fontSize": {
                "type": "string",
                "description": "Font size for subtitles",
                "example": "m",
                "default": "m",
                "enum": ["s", "m", "l", "xl"]
              }
            }
          }
        },
        "required": ["videoUrl", "webhookUrl", "language"]
      },
      "SuccessResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "description": "Status of the request",
            "example": "created"
          },
          "message": {
            "type": "string",
            "description": "Success message",
            "example": "project created successfully"
          },
          "projectId": {
            "type": "string",
            "description": "Project ID",
            "example": "667bbc6973e392d3f7f6f620"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string",
                "description": "Error message"
              }
            }
          }
        }
      },

      "NotFoundResponse404": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string",
                "description": "Error message",
                "example": "Video request not found."
              }
            }
          }
        }
      },

      "BadRequestErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string",
                "description": "Error message",
                "example": "Bad Request: Missing required fields"
              }
            }
          }
        }
      },
      "UnauthorizedErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string",
                "description": "Error message",
                "example": "Unauthorized: API key invalid"
              }
            }
          }
        }
      },

      "InternalServerErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string",
                "description": "Error message",
                "example": "Internal Server Error: Please try again later or contact support"
              }
            }
          }
        }
      },
      "TooManyRequestsErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string",
                "description": "Error message",
                "example": "Too Many Requests: Please slow down your request rate."
              }
            }
          }
        }
      }
    },
    "securitySchemes": {
      "apiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    }
  }
}
