{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/folio/main/json-schema/folio-tenant-job-schema.json",
  "title": "Tenant job",
  "description": "Tenant job information",
  "x-generated": "2026-10-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/folio-folio-vertx-lib-tenant-2-0-openapi.yml#/components/schemas/tenantJob",
  "type": "object",
  "properties": {
    "id": {
      "description": "Job ID",
      "type": "string",
      "format": "uuid"
    },
    "tenant": {
      "description": "Tenant ID",
      "type": "string"
    },
    "tenantAttributes": {
      "description": "Module information - content to initiate operation",
      "$ref": "#/$defs/tenantAttributes"
    },
    "complete": {
      "description": "Whether job is complete (true) or ongoing (false)",
      "type": "boolean"
    },
    "error": {
      "description": "Error message if error has occurred",
      "type": "string"
    },
    "messages": {
      "description": "Additional messages (warnings, errors)",
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "$defs": {
    "parameter": {
      "description": "List of key/value parameters of an error",
      "type": "object",
      "properties": {
        "key": {
          "description": "The key for this parameter",
          "type": "string"
        },
        "value": {
          "description": "The value of this parameter",
          "type": "string"
        }
      },
      "additionalProperties": false,
      "required": [
        "key"
      ]
    },
    "parameters": {
      "description": "List of key/value parameters",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "#/$defs/parameter"
      },
      "additionalProperties": false
    },
    "tenantAttributes": {
      "title": "Tenant job attributes",
      "description": "Configuration how to install, upgrade or delete a module for a tenant",
      "type": "object",
      "properties": {
        "module_from": {
          "description": "Existing module ID. If omitted, the module is not enabled already",
          "type": "string"
        },
        "module_to": {
          "description": "Target module ID. If omitted, the existing module is disabled.",
          "type": "string"
        },
        "purge": {
          "description": "On disable should data also be purged",
          "type": "boolean"
        },
        "parameters": {
          "description": "Parameters that controls what tenant init (eg reference data)",
          "$ref": "#/$defs/parameters"
        }
      },
      "additionalProperties": false
    }
  }
}