{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/audiopod-ai/json-schema/audiopod-ai-video-download-job-schema.json",
  "title": "VideoDownloadJob",
  "description": "Video download job information",
  "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/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"
  ],
  "$defs": {
    "ProcessingStatus": {
      "type": "string",
      "enum": [
        "PENDING",
        "PROCESSING",
        "COMPLETED",
        "FAILED",
        "CANCELLED"
      ],
      "title": "ProcessingStatus"
    },
    "VideoPlatform": {
      "type": "string",
      "enum": [
        "youtube",
        "tiktok",
        "instagram",
        "vimeo",
        "spotify",
        "twitter",
        "facebook",
        "twitch",
        "dailymotion",
        "other"
      ],
      "title": "VideoPlatform",
      "description": "Supported video platforms"
    }
  }
}