{
    "openapi": "3.1.0",
    "info": {
      "title": "Diarization Visualizer API",
      "description": "Backend API for speaker diarization visualization tool",
      "version": "1.0.0"
    },
    "paths": {
      "/api/videos": {
        "get": {
          "tags": [
            "videos"
          ],
          "summary": "List Videos",
          "description": "List all processed videos with basic metadata.\n\nReturns:\n    List of videos with metadata (title, duration, segments, etc.)",
          "operationId": "list_videos_api_videos_get",
          "responses": {
            "200": {
              "description": "Successful Response",
              "content": {
                "application/json": {
                  "schema": {
                    "items": {
                      "$ref": "#/components/schemas/VideoListItem"
                    },
                    "type": "array",
                    "title": "Response List Videos Api Videos Get"
                  }
                }
              }
            }
          }
        }
      },
      "/api/videos/{video_id}": {
        "get": {
          "tags": [
            "videos"
          ],
          "summary": "Get Video Details",
          "description": "Get detailed metadata for a specific video.\n\nArgs:\n    video_id: Video identifier\n    \nReturns:\n    Full video metadata including all segments",
          "operationId": "get_video_details_api_videos__video_id__get",
          "parameters": [
            {
              "name": "video_id",
              "in": "path",
              "required": true,
              "schema": {
                "type": "string",
                "title": "Video Id"
              }
            }
          ],
          "responses": {
            "200": {
              "description": "Successful Response",
              "content": {
                "application/json": {
                  "schema": {
                    "$ref": "#/components/schemas/VideoDetail"
                  }
                }
              }
            },
            "422": {
              "description": "Validation Error",
              "content": {
                "application/json": {
                  "schema": {
                    "$ref": "#/components/schemas/HTTPValidationError"
                  }
                }
              }
            }
          }
        }
      },
      "/api/videos/{video_id}/stream": {
        "get": {
          "tags": [
            "videos"
          ],
          "summary": "Stream Video",
          "description": "Stream video file with Range request support for seeking.\n\nThis enables instant seeking in the video player by supporting\nHTTP Range requests (RFC 7233).\n\nArgs:\n    video_id: Video identifier\n    request: FastAPI request object (for Range header)\n    \nReturns:\n    Video file stream with Range support",
          "operationId": "stream_video_api_videos__video_id__stream_get",
          "parameters": [
            {
              "name": "video_id",
              "in": "path",
              "required": true,
              "schema": {
                "type": "string",
                "title": "Video Id"
              }
            }
          ],
          "responses": {
            "200": {
              "description": "Successful Response",
              "content": {
                "application/json": {
                  "schema": {
  
                  }
                }
              }
            },
            "422": {
              "description": "Validation Error",
              "content": {
                "application/json": {
                  "schema": {
                    "$ref": "#/components/schemas/HTTPValidationError"
                  }
                }
              }
            }
          }
        }
      },
      "/api/videos/{video_id}/audio": {
        "get": {
          "tags": [
            "videos"
          ],
          "summary": "Stream Audio",
          "description": "Stream audio file.\n\nArgs:\n    video_id: Video identifier\n    \nReturns:\n    Audio file stream",
          "operationId": "stream_audio_api_videos__video_id__audio_get",
          "parameters": [
            {
              "name": "video_id",
              "in": "path",
              "required": true,
              "schema": {
                "type": "string",
                "title": "Video Id"
              }
            }
          ],
          "responses": {
            "200": {
              "description": "Successful Response",
              "content": {
                "application/json": {
                  "schema": {
  
                  }
                }
              }
            },
            "422": {
              "description": "Validation Error",
              "content": {
                "application/json": {
                  "schema": {
                    "$ref": "#/components/schemas/HTTPValidationError"
                  }
                }
              }
            }
          }
        }
      },
      "/api/videos/{video_id}/thumbnail": {
        "get": {
          "tags": [
            "videos"
          ],
          "summary": "Get Thumbnail",
          "description": "Get video thumbnail (if exists).\n\nArgs:\n    video_id: Video identifier\n    \nReturns:\n    Thumbnail image",
          "operationId": "get_thumbnail_api_videos__video_id__thumbnail_get",
          "parameters": [
            {
              "name": "video_id",
              "in": "path",
              "required": true,
              "schema": {
                "type": "string",
                "title": "Video Id"
              }
            }
          ],
          "responses": {
            "200": {
              "description": "Successful Response",
              "content": {
                "application/json": {
                  "schema": {
  
                  }
                }
              }
            },
            "422": {
              "description": "Validation Error",
              "content": {
                "application/json": {
                  "schema": {
                    "$ref": "#/components/schemas/HTTPValidationError"
                  }
                }
              }
            }
          }
        }
      },
      "/api/process": {
        "post": {
          "tags": [
            "pipeline"
          ],
          "summary": "Process Video",
          "description": "Submit a new YouTube URL for processing.\n\nArgs:\n    request: Processing request with URL and options\n    background_tasks: FastAPI background tasks\n    \nReturns:\n    Job information with job_id for tracking progress",
          "operationId": "process_video_api_process_post",
          "requestBody": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProcessRequest"
                }
              }
            },
            "required": true
          },
          "responses": {
            "200": {
              "description": "Successful Response",
              "content": {
                "application/json": {
                  "schema": {
                    "$ref": "#/components/schemas/ProcessResponse"
                  }
                }
              }
            },
            "422": {
              "description": "Validation Error",
              "content": {
                "application/json": {
                  "schema": {
                    "$ref": "#/components/schemas/HTTPValidationError"
                  }
                }
              }
            }
          }
        }
      },
      "/api/jobs/{job_id}": {
        "get": {
          "tags": [
            "pipeline"
          ],
          "summary": "Get Job Status",
          "description": "Get status of a processing job.\n\nArgs:\n    job_id: Job identifier\n    \nReturns:\n    Current job status and progress",
          "operationId": "get_job_status_api_jobs__job_id__get",
          "parameters": [
            {
              "name": "job_id",
              "in": "path",
              "required": true,
              "schema": {
                "type": "string",
                "title": "Job Id"
              }
            }
          ],
          "responses": {
            "200": {
              "description": "Successful Response",
              "content": {
                "application/json": {
                  "schema": {
                    "$ref": "#/components/schemas/JobInfo"
                  }
                }
              }
            },
            "422": {
              "description": "Validation Error",
              "content": {
                "application/json": {
                  "schema": {
                    "$ref": "#/components/schemas/HTTPValidationError"
                  }
                }
              }
            }
          }
        }
      },
      "/api/health": {
        "get": {
          "summary": "Health Check",
          "description": "Health check endpoint",
          "operationId": "health_check_api_health_get",
          "responses": {
            "200": {
              "description": "Successful Response",
              "content": {
                "application/json": {
                  "schema": {
  
                  }
                }
              }
            }
          }
        }
      },
      "/": {
        "get": {
          "summary": "Root",
          "description": "Root endpoint with API info",
          "operationId": "root__get",
          "responses": {
            "200": {
              "description": "Successful Response",
              "content": {
                "application/json": {
                  "schema": {
  
                  }
                }
              }
            }
          }
        }
      }
    },
    "components": {
      "schemas": {
        "HTTPValidationError": {
          "properties": {
            "detail": {
              "items": {
                "$ref": "#/components/schemas/ValidationError"
              },
              "type": "array",
              "title": "Detail"
            }
          },
          "type": "object",
          "title": "HTTPValidationError"
        },
        "JobInfo": {
          "properties": {
            "job_id": {
              "type": "string",
              "title": "Job Id"
            },
            "video_id": {
              "type": "string",
              "title": "Video Id"
            },
            "status": {
              "$ref": "#/components/schemas/JobStatus"
            },
            "progress": {
              "type": "number",
              "title": "Progress"
            },
            "current_stage": {
              "type": "string",
              "title": "Current Stage"
            },
            "message": {
              "type": "string",
              "title": "Message"
            },
            "started_at": {
              "type": "string",
              "title": "Started At"
            },
            "completed_at": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Completed At"
            },
            "error": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Error"
            }
          },
          "type": "object",
          "required": [
            "job_id",
            "video_id",
            "status",
            "progress",
            "current_stage",
            "message",
            "started_at"
          ],
          "title": "JobInfo",
          "description": "Job status information"
        },
        "JobStatus": {
          "type": "string",
          "enum": [
            "queued",
            "validating",
            "downloading",
            "processing_vad",
            "processing_diarization",
            "processing_embeddings",
            "processing_clustering",
            "finalizing",
            "completed",
            "failed"
          ],
          "title": "JobStatus"
        },
        "ProcessRequest": {
          "properties": {
            "url": {
              "type": "string",
              "title": "Url"
            },
            "skip_if_exists": {
              "type": "boolean",
              "title": "Skip If Exists",
              "default": true
            }
          },
          "type": "object",
          "required": [
            "url"
          ],
          "title": "ProcessRequest",
          "description": "Request to process a new video"
        },
        "ProcessResponse": {
          "properties": {
            "job_id": {
              "type": "string",
              "title": "Job Id"
            },
            "video_id": {
              "type": "string",
              "title": "Video Id"
            },
            "status": {
              "$ref": "#/components/schemas/JobStatus"
            },
            "message": {
              "type": "string",
              "title": "Message"
            }
          },
          "type": "object",
          "required": [
            "job_id",
            "video_id",
            "status",
            "message"
          ],
          "title": "ProcessResponse",
          "description": "Response after submitting processing job"
        },
        "SegmentInfo": {
          "properties": {
            "segment_id": {
              "type": "integer",
              "title": "Segment Id"
            },
            "start": {
              "type": "number",
              "title": "Start"
            },
            "end": {
              "type": "number",
              "title": "End"
            },
            "duration": {
              "type": "number",
              "title": "Duration"
            },
            "speaker": {
              "type": "string",
              "title": "Speaker"
            },
            "status": {
              "type": "string",
              "title": "Status"
            },
            "quality_score": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Quality Score"
            }
          },
          "type": "object",
          "required": [
            "segment_id",
            "start",
            "end",
            "duration",
            "speaker",
            "status"
          ],
          "title": "SegmentInfo",
          "description": "Segment metadata"
        },
        "ValidationError": {
          "properties": {
            "loc": {
              "items": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "integer"
                  }
                ]
              },
              "type": "array",
              "title": "Location"
            },
            "msg": {
              "type": "string",
              "title": "Message"
            },
            "type": {
              "type": "string",
              "title": "Error Type"
            }
          },
          "type": "object",
          "required": [
            "loc",
            "msg",
            "type"
          ],
          "title": "ValidationError"
        },
        "VideoDetail": {
          "properties": {
            "video_id": {
              "type": "string",
              "title": "Video Id"
            },
            "title": {
              "type": "string",
              "title": "Title"
            },
            "youtube_url": {
              "type": "string",
              "title": "Youtube Url"
            },
            "duration": {
              "type": "number",
              "title": "Duration"
            },
            "processed_date": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Processed Date"
            },
            "segments": {
              "items": {
                "$ref": "#/components/schemas/SegmentInfo"
              },
              "type": "array",
              "title": "Segments"
            },
            "speakers": {
              "items": {
                "type": "string"
              },
              "type": "array",
              "title": "Speakers"
            },
            "statistics": {
              "additionalProperties": true,
              "type": "object",
              "title": "Statistics"
            }
          },
          "type": "object",
          "required": [
            "video_id",
            "title",
            "youtube_url",
            "duration",
            "segments",
            "speakers",
            "statistics"
          ],
          "title": "VideoDetail",
          "description": "Detailed video metadata with all segments"
        },
        "VideoListItem": {
          "properties": {
            "video_id": {
              "type": "string",
              "title": "Video Id"
            },
            "title": {
              "type": "string",
              "title": "Title"
            },
            "duration": {
              "type": "number",
              "title": "Duration"
            },
            "processed_date": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Processed Date"
            },
            "thumbnail_url": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Thumbnail Url"
            },
            "has_video": {
              "type": "boolean",
              "title": "Has Video",
              "default": false
            },
            "has_audio": {
              "type": "boolean",
              "title": "Has Audio",
              "default": false
            },
            "segment_count": {
              "type": "integer",
              "title": "Segment Count",
              "default": 0
            },
            "speaker_count": {
              "type": "integer",
              "title": "Speaker Count",
              "default": 0
            }
          },
          "type": "object",
          "required": [
            "video_id",
            "title",
            "duration"
          ],
          "title": "VideoListItem",
          "description": "Video list item with basic metadata"
        }
      }
    }
  }