{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/azure-device-update-for-iot-hub-update-manifest/_shared/4--azure-deviceupdate-manifest-definitions-4.0.json",
  "title": "JSON Schema Definitions for Azure Device Update for IoT Hub Manifests version 4.0",
  "description": "Shared schema definitions for 'Import Manifest' and 'Update Manifest'.",
  "x-lintel": {
    "source": "https://www.schemastore.org/azure-deviceupdate-manifest-definitions-4.0.json",
    "sourceSha256": "4aa5c4cd4460d1b8e3a3f6374e08bcaac0da00d4c29bf15a541d5ebd77f6eb75"
  },
  "type": "object",
  "$defs": {
    "updateId": {
      "type": "object",
      "title": "Update identity",
      "description": "Unique update identifier.",
      "properties": {
        "provider": {
          "type": "string",
          "title": "Update provider",
          "description": "Entity who is creating or directly responsible for the update. It can be a company name.",
          "minLength": 1,
          "maxLength": 64,
          "pattern": "^[a-zA-Z0-9.-]+$"
        },
        "name": {
          "type": "string",
          "title": "Update name",
          "description": "Identifier for a class of update. It can be a device class or model name.",
          "minLength": 1,
          "maxLength": 64,
          "pattern": "^[a-zA-Z0-9.-]+$"
        },
        "version": {
          "type": "string",
          "title": "Update version",
          "description": "Two to four part dot separated numerical version numbers. Each part must be a number between 0 and 2147483647 and leading zeroes will be dropped.",
          "pattern": "^\\d+(?:\\.\\d+)+$",
          "examples": [
            "1.0",
            "2021.11.8"
          ]
        }
      },
      "required": [
        "provider",
        "name",
        "version"
      ],
      "additionalProperties": false
    },
    "compatibility": {
      "type": "array",
      "title": "Update compatibility",
      "description": "List of device property sets this update is compatible with.",
      "items": {
        "$ref": "https://catalog.lintel.tools/schemas/schemastore/azure-device-update-for-iot-hub-update-manifest/_shared/4--azure-deviceupdate-manifest-definitions-4.0.json#/$defs/compatibilityInfo"
      },
      "minItems": 1,
      "maxItems": 10
    },
    "compatibilityInfo": {
      "type": "object",
      "title": "Update compatibility info",
      "description": "Properties of a device this update is compatible with.",
      "maxProperties": 5,
      "minProperties": 1,
      "additionalProperties": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "propertyNames": {
          "minLength": 1,
          "maxLength": 32
        }
      }
    },
    "file": {
      "type": "object",
      "title": "Update file",
      "description": "Update payload file, e.g. binary, firmware, script, etc. Must be unique within update.",
      "properties": {
        "filename": {
          "$ref": "https://catalog.lintel.tools/schemas/schemastore/azure-device-update-for-iot-hub-update-manifest/_shared/4--azure-deviceupdate-manifest-definitions-4.0.json#/$defs/filename"
        },
        "sizeInBytes": {
          "type": "number",
          "title": "File size",
          "description": "File size in number of bytes.",
          "minimum": 1,
          "maximum": 2147483648
        },
        "hashes": {
          "$ref": "https://catalog.lintel.tools/schemas/schemastore/azure-device-update-for-iot-hub-update-manifest/_shared/4--azure-deviceupdate-manifest-definitions-4.0.json#/$defs/fileHashes"
        }
      },
      "required": [
        "filename",
        "sizeInBytes",
        "hashes"
      ],
      "additionalProperties": false
    },
    "filename": {
      "type": "string",
      "title": "Update file name",
      "description": "Update payload file name.",
      "minLength": 1,
      "maxLength": 255
    },
    "fileHashes": {
      "type": "object",
      "title": "File hashes",
      "description": "Base64-encoded file hashes with algorithm name as key. At least SHA-256 algorithm must be specified, and additional algorithm may be specified if supported by agent.",
      "properties": {
        "sha256": {
          "type": "string",
          "title": "SHA-256 hash value",
          "description": "Base64-encoded file hash value using SHA-256 algorithm."
        }
      },
      "required": [
        "sha256"
      ],
      "maxProperties": 2,
      "additionalProperties": {
        "type": "string",
        "propertyNames": {
          "maxLength": 10
        }
      }
    },
    "referenceStepType": {
      "type": "string",
      "title": "'Reference' step type",
      "description": "Instruction step type that installs another update.",
      "const": "reference"
    },
    "inlineStepType": {
      "type": "string",
      "title": "'Inline' step type",
      "description": "Instruction step type that performs code execution.",
      "const": "inline"
    },
    "inlineStepHandler": {
      "type": "string",
      "title": "Step handler",
      "description": "Identity of handler on device that can execute this step.",
      "pattern": "^\\S+/\\S+:\\d{1,5}$",
      "minLength": 5,
      "maxLength": 32,
      "examples": [
        "microsoft/script:1",
        "microsoft/swupdate:1",
        "microsoft/apt:1"
      ]
    },
    "inlineStepHandlerProperties": {
      "type": "object",
      "title": "Handler properties",
      "description": "JSON object that agent will pass to handler as arguments.",
      "additionalProperties": true
    }
  }
}
