{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/audiopod-ai/json-schema/audiopod-ai-video-download-stats-response-schema.json",
  "title": "VideoDownloadStatsResponse",
  "description": "Response for download statistics",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/audiopod-ai-media-extraction-api-openapi.yml#/components/schemas/VideoDownloadStatsResponse",
  "properties": {
    "total_downloads": {
      "type": "integer",
      "title": "Total Downloads",
      "description": "Total downloads by user"
    },
    "total_duration": {
      "type": "number",
      "title": "Total Duration",
      "description": "Total duration downloaded (seconds)"
    },
    "total_credits_used": {
      "type": "integer",
      "title": "Total Credits Used",
      "description": "Total credits used"
    },
    "downloads_by_platform": {
      "additionalProperties": {
        "type": "integer"
      },
      "type": "object",
      "title": "Downloads By Platform",
      "description": "Downloads by platform"
    },
    "downloads_by_format": {
      "additionalProperties": {
        "type": "integer"
      },
      "type": "object",
      "title": "Downloads By Format",
      "description": "Downloads by format"
    },
    "recent_downloads": {
      "items": {
        "$ref": "#/$defs/VideoDownloadJob"
      },
      "type": "array",
      "title": "Recent Downloads",
      "description": "Recent downloads"
    }
  },
  "type": "object",
  "required": [
    "total_downloads",
    "total_duration",
    "total_credits_used",
    "downloads_by_platform",
    "downloads_by_format",
    "recent_downloads"
  ],
  "$defs": {
    "ProcessingStatus": {
      "type": "string",
      "enum": [
        "PENDING",
        "PROCESSING",
        "COMPLETED",
        "FAILED",
        "CANCELLED"
      ],
      "title": "ProcessingStatus"
    },
    "VideoDownloadJob": {
      "properties": {
        "id": {
          "type": "integer",
          "title": "Id",
          "description": "Job ID (0 while only the fast-poll id exists)"
        },
        "redis_job_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Fast-poll job id",
          "description": "Fast-poll job id for public downloads (use for polling)"
        },
        "user_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "User Id",
          "description": "User ID"
        },
        "source_url": {
          "type": "string",
          "title": "Source Url",
          "description": "Source video URL"
        },
        "video_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Video Id",
          "description": "Platform video ID"
        },
        "platform": {
          "$ref": "#/$defs/VideoPlatform",
          "description": "Video platform"
        },
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Title",
          "description": "Video title"
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Description",
          "description": "Video description"
        },
        "uploader": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Uploader",
          "description": "Uploader name"
        },
        "duration": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Duration",
          "description": "Duration in seconds"
        },
        "upload_date": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Upload Date",
          "description": "Upload date (YYYYMMDD)"
        },
        "view_count": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "View Count",
          "description": "View count"
        },
        "thumbnail_url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Thumbnail Url",
          "description": "Thumbnail URL"
        },
        "requested_format": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Requested Format",
          "description": "Requested format"
        },
        "requested_quality": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Requested Quality",
          "description": "Requested quality"
        },
        "audio_only": {
          "type": "boolean",
          "title": "Audio Only",
          "description": "Audio only download",
          "default": false
        },
        "status": {
          "$ref": "#/$defs/ProcessingStatus",
          "description": "Job status"
        },
        "progress": {
          "type": "number",
          "title": "Progress",
          "description": "Progress percentage (0-100)",
          "default": 0.0
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "title": "Created At",
          "description": "Creation timestamp"
        },
        "updated_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Updated At",
          "description": "Last update timestamp"
        },
        "completed_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Completed At",
          "description": "Completion timestamp"
        },
        "error_message": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Error Message",
          "description": "Error message if failed"
        },
        "output_path": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Output Path",
          "description": "Storage path of the downloaded file"
        },
        "audio_path": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Audio Path",
          "description": "Storage path of the extracted audio"
        },
        "thumbnail_path": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Thumbnail Path",
          "description": "Storage path of the thumbnail image"
        },
        "file_size": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "File Size",
          "description": "File size in bytes"
        },
        "actual_format": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Actual Format",
          "description": "Actual format downloaded"
        },
        "estimated_credits": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Estimated Credits",
          "description": "Estimated credits"
        },
        "actual_credits": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Actual Credits",
          "description": "Actual credits used"
        },
        "parameters": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Parameters",
          "description": "Job parameters"
        },
        "result": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Result",
          "description": "Job result with download URLs"
        },
        "billing_status": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Billing Status",
          "description": "Billing status: PAID, DEFERRED, or REFUNDED"
        },
        "expires_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Expires At",
          "description": "When deferred job results expire"
        },
        "r2_purged_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "R2 Purged At"
        }
      },
      "type": "object",
      "required": [
        "id",
        "source_url",
        "platform",
        "status",
        "created_at"
      ],
      "title": "VideoDownloadJob",
      "description": "Video download job information"
    },
    "VideoPlatform": {
      "type": "string",
      "enum": [
        "youtube",
        "tiktok",
        "instagram",
        "vimeo",
        "spotify",
        "twitter",
        "facebook",
        "twitch",
        "dailymotion",
        "other"
      ],
      "title": "VideoPlatform",
      "description": "Supported video platforms"
    }
  }
}