{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pdf2md-dev/json-schema/pdf2md-dev-job-resource-schema.json",
  "title": "JobResource",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pdf2md-dev-openapi.json#/components/schemas/JobResource",
  "type": "object",
  "required": [
    "job_id",
    "converter_code",
    "status",
    "status_since",
    "priority",
    "priority_assigned_at",
    "file_name"
  ],
  "properties": {
    "job_id": {
      "type": "string",
      "format": "uuid"
    },
    "status": {
      "$ref": "#/$defs/JobStatus"
    },
    "converter_code": {
      "type": "string"
    },
    "status_since": {
      "type": "string",
      "format": "date-time",
      "description": "Time of entry into the current status (UTC)"
    },
    "priority": {
      "type": "integer",
      "format": "int32",
      "description": "A lower number — higher priority. v2 (EP-023, §7.7): a band scale, `min` is no longer 4 — the client treats the value as opaque (timers are computed from `status_since`/`ready_at`, not from priority).\n"
    },
    "priority_assigned_at": {
      "type": "string",
      "format": "date-time",
      "description": "When priority was assigned/lowered"
    },
    "error_message": {
      "type": [
        "string",
        "null"
      ]
    },
    "error_code": {
      "type": [
        "string",
        "null"
      ],
      "description": "Stable machine error code for a failed job (EP-031). Additive — absent on\nsuccess and on older records. Clients localize by this code; the human\nerror_message is a fallback.\n"
    },
    "file_name": {
      "type": "string",
      "maxLength": 255
    },
    "output_size": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64",
      "description": "Markdown size (bytes), only for `ready`"
    },
    "download_url": {
      "type": [
        "string",
        "null"
      ],
      "format": "uri",
      "description": "Populated for `ready`"
    },
    "pages": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Number of pages in the source PDF (EP-018). An additive field — absent on the old backend/old jobs; clients should ignore it if missing.\n"
    },
    "truncated": {
      "type": "boolean",
      "default": false,
      "description": "`true` — the result is partial: conversion reached the soft time budget and a disclaimer was appended to the end of the Markdown (EP-018). Additive, backward-compatible: absence/`false` = full result.\n"
    }
  },
  "$defs": {
    "JobStatus": {
      "type": "string",
      "description": "Job status",
      "enum": [
        "queued",
        "processing",
        "ready",
        "error",
        "canceled",
        "deleted"
      ]
    }
  }
}