{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://raw.githubusercontent.com/api-evangelist/zamzar/main/json-schema/job.json",
  "title": "Job",
  "type": "object",
  "description": "Represents the process of converting a file to another format.",
  "required": ["id"],
  "properties": {
    "id": {
      "type": "integer",
      "format": "int32",
      "description": "The unique identifier assigned to the job",
      "example": 1
    },
    "key": {
      "type": "string",
      "description": "The API key used to create the job",
      "example": "apikey"
    },
    "status": {
      "type": "string",
      "description": "The current status of the job",
      "enum": ["initialising", "converting", "successful", "failed", "cancelled"],
      "example": "failed"
    },
    "failure": {
      "$ref": "failure.json"
    },
    "sandbox": {
      "type": "boolean",
      "description": "Indicates whether or not the job was processed on the developer sandbox (i.e. at no cost)",
      "example": false
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "The time at which the job was created (UTC in ISO_8601)",
      "example": "2022-01-01T14:15:22Z"
    },
    "finished_at": {
      "type": ["string", "null"],
      "format": "date-time",
      "description": "The time at which the job finished if successful, or null otherwise (UTC in ISO_8601)",
      "example": "2022-01-01T14:15:22Z"
    },
    "source_file": {
      "$ref": "file.json"
    },
    "target_files": {
      "type": "array",
      "description": "The output from the job",
      "items": {
        "$ref": "file.json"
      }
    },
    "target_format": {
      "type": "string",
      "description": "The name of the format to which source_file is being converted",
      "example": "bmp"
    },
    "credit_cost": {
      "type": "integer",
      "format": "int32",
      "description": "The cost in conversion credits of the job",
      "example": 1
    },
    "export_url": {
      "type": "string",
      "description": "The location to which all converted files will be copied",
      "example": "s3://CREDENTIAL_NAME@my-bucket-name/logo.jpg"
    },
    "options": {
      "type": "object",
      "description": "Additional options for the conversion",
      "additionalProperties": true
    }
  }
}
