{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/youspot-com/json-schema/youspot-com-job-schema.json",
  "title": "Job",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/youspot-com-openapi.json#/components/schemas/Job",
  "type": "object",
  "required": [
    "success",
    "job_id",
    "kind",
    "state",
    "terminal"
  ],
  "properties": {
    "success": {
      "type": "boolean"
    },
    "job_id": {
      "type": "integer"
    },
    "kind": {
      "type": "string",
      "description": "What the job does, e.g. `file_import`."
    },
    "state": {
      "type": "string",
      "enum": [
        "queued",
        "running",
        "succeeded",
        "failed",
        "cancelled"
      ]
    },
    "terminal": {
      "type": "boolean",
      "description": "True once the state can no longer change. Stop polling."
    },
    "attempts": {
      "type": "integer",
      "description": "Runs so far, including the current one."
    },
    "progress": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": true,
      "description": "Whatever the job checkpoints as it goes. Shape depends on `kind`."
    },
    "created_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "started_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "finished_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "result": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": true,
      "description": "Filled once `state` is `succeeded`."
    },
    "error": {
      "type": [
        "string",
        "null"
      ],
      "description": "Filled once `state` is `failed`."
    }
  }
}