{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/mediacaption-api/json-schema/mediacaption-api-job-schema.json",
  "title": "Job",
  "x-generated": "2026-11-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/mediacaption-api-jobs-api-openapi.yml#/components/schemas/Job",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "id",
    "type",
    "status",
    "progress",
    "itemCount",
    "completedCount",
    "failedCount",
    "creditsFrozen",
    "creditsCharged",
    "creditsRefunded",
    "createdAt",
    "startedAt",
    "completedAt",
    "items",
    "nextCursor"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "enum": [
        "public_transcripts_bulk"
      ]
    },
    "status": {
      "$ref": "#/$defs/JobStatus"
    },
    "progress": {
      "type": "integer",
      "minimum": 0,
      "maximum": 100
    },
    "itemCount": {
      "type": "integer"
    },
    "completedCount": {
      "type": "integer"
    },
    "failedCount": {
      "type": "integer"
    },
    "creditsFrozen": {
      "type": "integer"
    },
    "creditsCharged": {
      "type": "integer"
    },
    "creditsRefunded": {
      "type": "integer"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "startedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "completedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "items": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/JobItem"
      }
    },
    "nextCursor": {
      "type": [
        "string",
        "null"
      ]
    }
  },
  "$defs": {
    "ItemError": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "code",
        "message"
      ],
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    },
    "JobItem": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "externalId",
        "status",
        "sourceType",
        "sourceUrl",
        "videoId",
        "language",
        "transcriptionId",
        "durationSec",
        "creditsFrozen",
        "creditsCharged",
        "creditsRefunded",
        "createdAt",
        "completedAt"
      ],
      "properties": {
        "externalId": {
          "type": [
            "string",
            "null"
          ]
        },
        "status": {
          "$ref": "#/$defs/JobItemStatus"
        },
        "sourceType": {
          "type": "string",
          "enum": [
            "youtube"
          ]
        },
        "sourceUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "videoId": {
          "type": [
            "string",
            "null"
          ]
        },
        "language": {
          "type": [
            "string",
            "null"
          ]
        },
        "transcriptionId": {
          "type": [
            "string",
            "null"
          ]
        },
        "durationSec": {
          "type": [
            "number",
            "null"
          ]
        },
        "creditsFrozen": {
          "type": "integer"
        },
        "creditsCharged": {
          "type": "integer"
        },
        "creditsRefunded": {
          "type": "integer"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "completedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "error": {
          "$ref": "#/$defs/ItemError"
        }
      }
    },
    "JobItemStatus": {
      "type": "string",
      "enum": [
        "queued",
        "processing",
        "completed",
        "failed"
      ]
    },
    "JobStatus": {
      "type": "string",
      "enum": [
        "queued",
        "processing",
        "completed",
        "completed_with_errors",
        "failed",
        "canceled"
      ]
    }
  }
}