{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/audivo-dev/json-schema/audivo-dev-resolve-result-schema.json",
  "title": "ResolveResult",
  "description": "Resolves a pointer to canonical IDs without creating a job.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/audivo-dev-catalog-api-openapi.yml#/components/schemas/ResolveResult",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "episode_id",
    "show_id",
    "is_cached"
  ],
  "properties": {
    "episode_id": {
      "$ref": "#/$defs/EpisodeId"
    },
    "show_id": {
      "$ref": "#/$defs/ShowId"
    },
    "is_cached": {
      "type": "boolean"
    },
    "estimated_credits": {
      "anyOf": [
        {
          "$ref": "#/$defs/CreditAmount"
        },
        {
          "enum": [
            null
          ]
        }
      ]
    },
    "quote_basis": {
      "anyOf": [
        {
          "$ref": "#/$defs/QuoteBasis"
        },
        {
          "enum": [
            null
          ]
        }
      ]
    },
    "estimated_seconds": {
      "description": "Estimated wall-clock processing seconds, or `null` when the pointer resolved but nothing has been estimated yet (e.g. the episode is already cached, so no fresh work would be scheduled).",
      "anyOf": [
        {
          "$ref": "#/$defs/EstimatedProcessingSeconds"
        },
        {
          "enum": [
            null
          ]
        }
      ]
    }
  },
  "$defs": {
    "CreditAmount": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991,
      "description": "A non-negative JavaScript-safe integer credit amount. The upper bound matches `Number.MAX_SAFE_INTEGER`, which is enforced by the domain ledger so arithmetic and JSON round-trips cannot silently lose cents worth of credit precision."
    },
    "EpisodeId": {
      "type": "string",
      "pattern": "^ep_[a-z2-7]{16}$",
      "description": "Canonical episode identifier."
    },
    "EstimatedProcessingSeconds": {
      "type": "integer",
      "minimum": 0,
      "maximum": 72000,
      "description": "Estimated **wall-clock** seconds until the job reaches a terminal state — intended for choosing a poll interval. This is *not* audio duration: audio duration has its own field (`duration_sec` on the transcript, `duration_sec` on `EpisodeSummary`), and conflating the two silently misprices everything a caller derives from it. The committed examples only make sense under this reading: `estimated_seconds: 420` alongside `estimated_credits: 268` cannot be audio seconds, because 7 audio minutes bills 7 credits at `CREDITS_PER_AUDIO_MINUTE`, while 268 credits is about 4.5 hours of audio.\n\nThe bound is derived from that meaning rather than copied from the audio cap: twice the published 10-hour `max_audio_duration_seconds` ceiling, an end-to-end envelope that still holds at a pathological 1× realtime factor. The real hard per-job timeout is duration-scaled and much shorter."
    },
    "QuoteBasis": {
      "type": "string",
      "enum": [
        "feed_metadata",
        "probed",
        "declared"
      ],
      "description": "`feed_metadata` when the estimate is derived from feed-published duration; `probed` when a bounded enclosure probe measured it. `declared` when the caller stated it for an upload (ADR-0031)."
    },
    "ShowId": {
      "type": "string",
      "pattern": "^sh_[a-z2-7]{16}$",
      "description": "Canonical show identifier."
    }
  }
}