{
  "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": {
    "/bgm": {
      "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"
          },
          "webhookUrl": {
            "type": "string",
            "description": "Webhook URL for receiving processing updates",
            "example": "https://webhook-test.com/05674b0b229c29199fec105309a00e16"
          }
        },
        "required": ["videoUrl", "webhookUrl"]
      },
      "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"
      }
    }
  }
}
