{
  "required": [
    "name",
    "id",
    "appliesTo",
    "properties"
  ],
  "properties": {
    "$schema": {
      "$id": "#/$schema",
      "type": "string",
      "description": "Reference to the Element Template JSON schema this document follows."
    },
    "name": {
      "$id": "#/name",
      "type": "string",
      "description": "Template name. Shown during template selection and editing of a templated element. Required."
    },
    "id": {
      "$id": "#/id",
      "type": "string",
      "description": "Template identifier. Required."
    },
    "description": {
      "$id": "#/description",
      "type": "string",
      "description": "Template description. Shown during template selection and editing of a templated element."
    },
    "version": {
      "$id": "#/version",
      "type": "integer",
      "description": "Optional version of the template. If you add a version to a template, it will be considered unique based on its ID and version. Two templates can have the same ID if their versions are different."
    },
    "isDefault": {
      "$id": "#/isDefault",
      "type": "boolean",
      "description": "Indicates whether the element template is a default template."
    },
    "deprecated": {
      "$id": "#/deprecated",
      "type": ["boolean", "object"],
      "description": "Marks the template as deprecated. Value can be either a boolean or an object with a message and a link to migration documentation.",
      "properties": {
        "message": {
          "$id": "#/deprecated/message",
          "type": "string",
          "description": "Optional message to describe migration path."
        },
        "documentationRef": {
          "$id": "#/deprecated/documentationRef",
          "type": "string",
          "pattern": "^(https|http)://.*",
          "description": "URL pointing to template documentation. Must be a valid http(s) URL."
        }
      }
    },
    "appliesTo": {
      "$id": "#/appliesTo",
      "type": "array",
      "description": "List of BPMN types the template can be applied to. Required.",
      "default": [],
      "items": {
        "$id": "#/appliesTo/items",
        "type": "string",
        "pattern": "^[\\w\\d]+:[\\w\\d]+$",
        "allOf": [
          {
            "$ref": "examples.json#/appliesTo"
          }
        ]
      }
    },
    "elementType": {
      "$id": "#/elementType",
      "type": "object",
      "description": "Object that sets the type of the element. Some properties require a specific value for elementType.",
      "default": {},
      "required": [
        "value"
      ],
      "properties": {
        "value": {
          "$id": "#/elementType/value",
          "type": "string",
          "pattern": "^[\\w\\d]+:[\\w\\d]+$",
          "description": "Specifies the target BPMN element type. The element is replaced with the specified type when a user applies the template. Required if using elementType.",
          "allOf": [
            {
              "$ref": "examples.json#/elementType"
            }
          ]
        }
      }
    },
    "metadata": {
      "$id": "#/metadata",
      "type": "object",
      "description": "Some custom properties for further configuration.",
      "default": {}
    },
    "keywords": {
      "$id": "#/keywords",
      "type": "array",
      "items": { "type": "string" },
      "description": "List of keywords to help users find the template. Used in search and filtering, but not displayed in the UI.",
      "default": []
    },
    "groups": {
      "$ref": "groups.json"
    },
    "documentationRef": {
      "$id": "#/documentationRef",
      "type": "string",
      "pattern": "^(https|http)://.*"
    }
  }
}
