{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://heartcortex.ai/schemas/1.0/software.schema.json",
  "title": "software",
  "type": "object",
  "required": [],
  "properties": {
    "packages": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "name",
          "version"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "kind": {
            "enum": [
              "firmware",
              "os",
              "application",
              "model",
              "library"
            ]
          }
        }
      },
      "x-heart-privacy": "internal"
    },
    "channel": {
      "type": "string",
      "x-heart-privacy": "internal"
    },
    "bootSlot": {
      "type": "string",
      "x-heart-privacy": "internal"
    },
    "lastUpdate": {
      "$ref": "common.schema.json#/$defs/timestamp",
      "x-heart-privacy": "internal"
    },
    "available": {
      "type": "array",
      "x-heart-privacy": "internal",
      "description": "Updates offered to this system (GET /heart/v1/software/updates).",
      "items": {
        "type": "object",
        "required": [
          "version"
        ],
        "properties": {
          "package": {
            "type": "string",
            "description": "The package it updates."
          },
          "version": {
            "type": "string"
          },
          "kind": {
            "enum": [
              "firmware",
              "os",
              "application",
              "model",
              "library"
            ]
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 0
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "Digest of the payload, from the signed manifest."
          },
          "signed": {
            "type": "boolean",
            "description": "True only if the manifest is signed by a key the system trusts. An update that is not is never installed."
          },
          "notes": {
            "type": "string"
          },
          "security": {
            "type": "boolean",
            "description": "True if it fixes a security problem."
          }
        }
      }
    },
    "updatePolicy": {
      "type": "object",
      "x-heart-privacy": "internal",
      "properties": {
        "auto": {
          "enum": [
            "none",
            "download",
            "install"
          ],
          "description": "none: only on request. download: fetch, then wait for a person. install: install in the window."
        },
        "window": {
          "type": "string",
          "description": "When automatic installs may happen, as a schedule id or RFC 5545 RRULE."
        }
      },
      "description": "Set in the system's own configuration. The API only reads it."
    },
    "ext": {
      "$ref": "common.schema.json#/$defs/ext",
      "x-heart-privacy": "private"
    }
  }
}
