{
  "id": "job.json",
  "$schema": "http://json-schema.org/draft-04/schema",
  "title": "Job",
  "description": "Long-running job",
  "type": "object",
  "properties": {
    "id": {
      "$ref": "base.json#/definitions/uuid"
    },
    "type": {
      "type": "string",
      "description": "The specific type of job",
      "example": "share",
      "enum": [
        "share",
        "publish"
      ]
    },
    "source": {
      "type": "string",
      "description": "The endpoint that created this job",
      "example": "/share"
    },
    "completed": {
      "type": "boolean",
      "description": "Whether the job is completed or not"
    },
    "failed": {
      "type": "boolean",
      "description": "Whether the job failed or not"
    },
    "started_at": {
      "type": "string",
      "description": "Time the job was started",
      "format": "date-time"
    },
    "finished_at": {
      "description": "Time the job was finished (failed or completed).",
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "string",
          "format": "date-time"
        }
      ]
    },
    "item": {
      "$ref": "base.json#/definitions/uuid",
      "description": "The content Item this job is associated with, if any"
    },
    "tasks": {
      "type": "object",
      "description": "Details about the tasks in this job. Job type specific."
    }
  },
  "required": [
    "type",
    "tasks"
  ]
}