{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/kinopipe-com/json-schema/kinopipe-com-job-status-schema.json",
  "title": "JobStatus",
  "x-generated": "2026-11-13",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/kinopipe-com-openapi.json#/components/schemas/JobStatus",
  "type": "object",
  "required": [
    "ok",
    "job"
  ],
  "properties": {
    "ok": {
      "const": true
    },
    "job": {
      "$ref": "#/$defs/Job"
    },
    "result": {
      "$ref": "#/$defs/JobResult"
    }
  },
  "$defs": {
    "Error": {
      "type": "object",
      "required": [
        "error"
      ],
      "properties": {
        "error": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    },
    "Job": {
      "type": "object",
      "required": [
        "id",
        "status",
        "progress"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "queued",
            "processing",
            "succeeded",
            "failed",
            "canceled"
          ]
        },
        "progress": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        },
        "consumedCredits": {
          "type": "integer",
          "minimum": 0
        },
        "reservedCredits": {
          "type": "integer",
          "minimum": 0,
          "description": "Credits reserved for this job before it was enqueued."
        },
        "maxCredits": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 1,
          "maximum": 720,
          "description": "Hard billable credit ceiling, when supplied. For edits it caps worker time and output size; for analyses, which are billed per started minute of media, it caps how long the input may be and is checked before the work starts."
        },
        "creditBalance": {
          "type": "integer",
          "minimum": 0
        },
        "error": {
          "$ref": "#/$defs/Error"
        }
      }
    },
    "JobResult": {
      "type": "object",
      "required": [
        "output",
        "runtimeMs"
      ],
      "properties": {
        "output": {
          "$ref": "#/$defs/MediaOutput"
        },
        "outputs": {
          "type": "array",
          "minItems": 1,
          "maxItems": 50,
          "items": {
            "$ref": "#/$defs/MediaOutput"
          }
        },
        "runtimeMs": {
          "type": "integer",
          "minimum": 0
        },
        "analysis": {
          "type": "object",
          "additionalProperties": true,
          "description": "Present for analysis tools (detect-scenes, detect-silence, analyze-audio, detect-visual-issues, describe-video): the same JSON as the output file, inline. Also present on smart-crop-video renders (kind smart_crop: the layout chosen per shot). The kind field names the shape: scene_detection, silence_detection, audio_analysis, visual_issues, video_description or smart_crop."
        }
      }
    },
    "MediaOutput": {
      "type": "object",
      "required": [
        "objectKey",
        "downloadUrl",
        "contentType",
        "byteSize"
      ],
      "properties": {
        "objectKey": {
          "type": "string"
        },
        "storageUri": {
          "type": "string",
          "description": "Provider-neutral storage URI such as r2://bucket/key or gs://bucket/key."
        },
        "gcsUri": {
          "type": "string",
          "deprecated": true,
          "description": "Legacy storage URI field kept for backward compatibility."
        },
        "downloadUrl": {
          "type": "string",
          "format": "uri",
          "description": "Signed temporary download URL."
        },
        "downloadUrlExpiresAt": {
          "type": "string",
          "format": "date-time"
        },
        "contentType": {
          "type": "string"
        },
        "byteSize": {
          "type": "integer",
          "minimum": 0
        },
        "filename": {
          "type": "string"
        }
      }
    }
  }
}