{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://localendpoints.com/schemas/localendpoint.endpoint-plugin-install.schema.json",
  "title": "LocalEndpoint Endpoint Plugin Install Manifest",
  "description": "Describes a separately installed endpoint plugin for local LocalEndpoint Connect intake. A valid manifest does not grant runtime authority.",
  "type": "object",
  "required": [
    "schema",
    "pluginId",
    "displayName",
    "domain",
    "installKind",
    "version",
    "installedUtc",
    "enabled",
    "userApproved",
    "capabilities"
  ],
  "properties": {
    "schema": {
      "type": "string",
      "const": "localendpoint.endpoint-plugin-install.v1"
    },
    "pluginId": {
      "type": "string",
      "minLength": 3,
      "maxLength": 120,
      "pattern": "^[a-z0-9][a-z0-9.-]*[a-z0-9]$"
    },
    "displayName": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "domain": {
      "type": "string",
      "minLength": 3,
      "maxLength": 120,
      "pattern": "^[a-z0-9][a-z0-9.-]*[a-z0-9]$"
    },
    "installKind": {
      "type": "string",
      "enum": [
        "separate-install"
      ]
    },
    "version": {
      "type": "string",
      "minLength": 1,
      "maxLength": 60
    },
    "installedUtc": {
      "type": "string",
      "format": "date-time"
    },
    "enabled": {
      "type": "boolean"
    },
    "userApproved": {
      "type": "boolean"
    },
    "capabilities": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 120
      }
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "pluginId": {
            "const": "remoteendpoints.com"
          }
        },
        "required": [
          "pluginId"
        ]
      },
      "then": {
        "properties": {
          "domain": {
            "const": "remoteendpoints.com"
          },
          "installKind": {
            "const": "separate-install"
          },
          "enabled": {
            "const": true
          },
          "userApproved": {
            "const": true
          },
          "capabilities": {
            "items": {
              "enum": [
                "away-review",
                "protected-remote-messages",
                "remote-operator-approval"
              ]
            }
          }
        }
      }
    }
  ],
  "additionalProperties": false
}
