{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/jellypod-com/json-schema/jellypod-com-episode-detail-schema.json",
  "title": "EpisodeDetail",
  "description": "A podcast episode with publishing metadata, audio/video URLs when available, and its production progress.",
  "x-generated": "2026-11-13",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/jellypod-com-api-openapi.json#/components/schemas/EpisodeDetail",
  "type": "object",
  "properties": {
    "audio_url": {
      "type": [
        "string",
        "null"
      ],
      "readOnly": true
    },
    "created_at": {
      "type": "string",
      "readOnly": true
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "generation": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "completed_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "error_message": {
          "type": "string"
        },
        "started_at": {
          "type": "string"
        },
        "state": {
          "type": "string",
          "enum": [
            "generating",
            "completed",
            "failed"
          ]
        },
        "skipped_sources": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "url": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "reason": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "title",
              "url",
              "reason"
            ]
          }
        }
      },
      "required": [
        "completed_at",
        "started_at",
        "state"
      ],
      "readOnly": true
    },
    "host_ids": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string"
      }
    },
    "id": {
      "type": "string",
      "format": "uuid",
      "readOnly": true
    },
    "image_url": {
      "type": [
        "string",
        "null"
      ]
    },
    "podcast_id": {
      "type": "string",
      "format": "uuid"
    },
    "published_at": {
      "type": [
        "string",
        "null"
      ],
      "readOnly": true
    },
    "scheduled_at": {
      "type": [
        "string",
        "null"
      ],
      "readOnly": true
    },
    "source_ids": {
      "type": "array",
      "items": {
        "type": "string",
        "format": "uuid"
      },
      "readOnly": true
    },
    "status": {
      "$ref": "#/$defs/EpisodeStatus"
    },
    "title": {
      "type": [
        "string",
        "null"
      ]
    },
    "updated_at": {
      "type": "string",
      "readOnly": true
    },
    "url": {
      "type": [
        "string",
        "null"
      ],
      "readOnly": true
    },
    "video_url": {
      "type": [
        "string",
        "null"
      ],
      "readOnly": true
    },
    "outputs": {
      "type": "object",
      "properties": {
        "audio": {
          "type": "object",
          "properties": {
            "current": {
              "type": "boolean"
            },
            "download_url": {
              "type": [
                "string",
                "null"
              ],
              "format": "uri"
            },
            "error": {
              "type": [
                "string",
                "null"
              ]
            },
            "status": {
              "type": "string",
              "enum": [
                "not_requested",
                "preparing",
                "available",
                "failed"
              ]
            }
          },
          "required": [
            "current",
            "download_url",
            "error",
            "status"
          ]
        },
        "video": {
          "type": "object",
          "properties": {
            "current": {
              "type": "boolean"
            },
            "download_url": {
              "type": [
                "string",
                "null"
              ],
              "format": "uri"
            },
            "error": {
              "type": [
                "string",
                "null"
              ]
            },
            "status": {
              "type": "string",
              "enum": [
                "not_requested",
                "preparing",
                "available",
                "failed"
              ]
            }
          },
          "required": [
            "current",
            "download_url",
            "error",
            "status"
          ]
        }
      },
      "required": [
        "audio",
        "video"
      ]
    },
    "progress": {
      "$ref": "#/$defs/EpisodeProgress"
    }
  },
  "required": [
    "audio_url",
    "created_at",
    "description",
    "generation",
    "host_ids",
    "id",
    "image_url",
    "podcast_id",
    "published_at",
    "scheduled_at",
    "source_ids",
    "status",
    "title",
    "updated_at",
    "url",
    "video_url",
    "outputs",
    "progress"
  ],
  "$defs": {
    "EpisodeProgress": {
      "type": "object",
      "properties": {
        "error": {
          "type": [
            "string",
            "null"
          ],
          "description": "Why generation or rendering failed, when it did."
        },
        "needs_attention": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "missing_visuals": {
              "type": "integer",
              "minimum": 0
            },
            "skipped_sources": {
              "type": "integer",
              "minimum": 0
            },
            "unvoiced_lines": {
              "type": "integer",
              "minimum": 0
            }
          },
          "required": [
            "missing_visuals",
            "skipped_sources",
            "unvoiced_lines"
          ],
          "description": "Gaps a usable episode still has, such as lines without audio or skipped sources. Fix them in Studio; null when there are none."
        },
        "phase": {
          "type": [
            "string",
            "null"
          ],
          "description": "The work still in flight, such as `rendering` or `finalizing_outputs`. Null once the episode is idle, completed, or failed."
        },
        "poll_after_seconds": {
          "type": "number",
          "minimum": 0,
          "description": "Seconds to wait before reading the episode again. Zero means it will not change on its own."
        },
        "render_required": {
          "type": "boolean",
          "description": "True when the content is ready but has no playable or downloadable output and nothing is preparing one, as after a caption or watermark edit. Outputs stay unavailable until a new render or export is requested. Call `POST /episodes/{episode_id}/export` to produce one."
        },
        "status": {
          "type": "string",
          "enum": [
            "idle",
            "generating",
            "completed",
            "failed"
          ],
          "description": "Whether the requested episode work is still running. `completed` means generation and all requested files finished. Individual output status reports each file before the request finishes."
        }
      },
      "required": [
        "error",
        "needs_attention",
        "phase",
        "poll_after_seconds",
        "render_required",
        "status"
      ],
      "description": "Where the episode stands across generation and rendering. MCP `get_content` reports the same progress.",
      "readOnly": true
    },
    "EpisodeStatus": {
      "type": "string",
      "enum": [
        "draft",
        "published",
        "scheduled"
      ],
      "description": "Lifecycle state stored on the episode row. Generation progress is reported separately on the `generation` field, `generating`/`completed`/`failed` are not `status` values.",
      "readOnly": true
    }
  }
}