{
  "$schema": "https://json-schema.org/draft-07/schema",
  "$id": "https://teamspeak.com/specs/extensions.scheme.json",
  "title": "TeamSpeak Extension",
  "description": "A TeamSpeak Extension meta data file for the TeamSpeak client",
  "type": "object",
  "additionalProperties": false,
  "required": [ "engines", "identifier", "image", "repository", "author", "description", "name", "version", "content", "license" ],
  "properties": {
    "engines": {
      "type": "object",
      "required": [ "teamspeak" ],
      "minProperties": 1,
      "maxProperties": 1,
      "additionalProperties": false,
      "properties": {
        "teamspeak": {
          "description": "The version of the extension meta data information specification this file adheres to",
          "type": "integer",
          "minimum": 1
        }
      }
    },
    "version": {
      "description": "The version of this extension. Use SemVer versioning, see https://semver.org",
      "type": "string",
      "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
    },
    "name": {
      "description": "The name of this extension as displayed in the UI",
      "type": "string",
      "maxLength": 64,
      "minLength": 5
    },
    "description": {
      "description": "A short concise description of what this extension does",
      "type": "string",
      "maxLength": 256,
      "minLength": 20
    },
    "author": {
      "description": "Information about the author",
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "required": [ "name" ],
          "properties": {
            "name": {
              "description": "Name of the author",
              "type": "string",
              "maxLength": 64,
              "minLength": 3
            },
            "email": {
              "description": "Contact email address of the author",
              "type": "string",
              "format": "email"
            },
            "url": {
              "description": "A link to a website to a website of the author",
              "type": "string",
              "pattern": "^https://.*\\..*"
            },
            "userTag": {
              "description": "Public chat alias of the author. See Settings -> Chat -> User Tags",
              "type": "string",
              "format": "email"
            }
          }
        },
        {
          "type": "string",
          "maxLength": 64,
          "minLength": 3
        }
      ]
    },
    "homepage": {
      "description": "A link where further information can be found about this extension",
      "type": "string",
      "maxLength": 1024,
      "pattern": "^https://.*\\..*"
    },
    "docsUrl": {
      "description": "An optional link where documentation for this extension can be found",
      "type": "string",
      "maxLength": 1024,
      "pattern": "^https://.*\\..*"
    },
    "repository": {
      "description": "The repository information where the source code for this extension can be found",
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "required": [ "type", "url" ],
          "properties": {
            "type": {
              "description": "The type of the repository (e.g. git) ",
              "type": "string",
              "enum": [ "git", "svn" ]
            },
            "url": {
              "description": "The url of a public git repository that contains the source code for this extension",
              "type": "string",
              "maxLength": 1024,
              "pattern": "^https://.*\\..*"
            },
            "directory": {
              "description": "Optional sub directory within the git repository specified that contains the source code, if the repository contains more than just the source code for this extension",
              "type": "string",
              "maxLength": 256
            }
          }
        },
        {
          "type": "string",
          "pattern": "^https://.*\\..*",
          "minLength": 15,
          "maxLength": 512
        }
      ]
    },
    "community": {
      "description": "Optional links to the support / community for this extension",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "room": {
          "description": "An optional public room alias, which people can join to discuss or get help with this extension",
          "type": "string",
          "pattern": "^#.*:([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])(\\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9]))*$",
          "maxLength": 256,
          "minLength": 20
        },
        "server": {
          "description": "An optional teamspeak server address, which people can join to discuss or get help with this extension",
          "type": "string",
          "format": "hostname",
          "maxLength": 128,
          "minLength": 3
        }
      }
    },
    "identifier": {
      "description": "A unique identifier for this extension",
      "type": "string",
      "pattern": "^[a-z]{2,}\\.([a-z]{3,}\\.){1,}[a-z]{3,}$",
      "maxLength": 64,
      "minLength": 11
    },
    "image": {
      "description": "File name of an image to display for this extension",
      "type": "string",
      "minLength": 6
    },
    "license": {
      "description": "The license this work falls under",
      "type": "string",
      "maxLength": 20,
      "minLength": 3
    },
    "keywords": {
      "description": "Short concise keywords describing the extension",
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 10,
        "minLength": 3
      },
      "maxItems": 5,
      "uniqueItems": true
    },
    "content": {
      "description": "Describes the content of this extension",
      "type": "object",
      "minProperties": 1,
      "additionalProperties": false,
      "properties": {
        "themes": {
          "description": "Information about the theme part of the extension",
          "type": "array",
          "minItems": 1,
          "maxItems": 20,
          "uniqueItems": true,
          "items": {
            "type": "object",
            "required": [ "name", "source", "apiVersion", "image" ],
            "additionalProperties": false,
            "properties": {
              "name": {
                "description": "The name of this theme variant for UI display",
                "type": "string",
                "minLength": 4,
                "maxLength": 30
              },
              "source": {
                "description": "The source file to load for this theme",
                "type": "string",
                "pattern": "^[-\\w\\s=\\.]{3,200}$"
              },
              "apiVersion": {
                "description": "The theme API version this theme implements. Future client releases may choose to not load themes that have an incompatible API version",
                "type": "integer",
                "minimum": 1
              },
              "image": {
                "description": "A small preview image of this theme variant",
                "type": "string",
                "pattern": "^.*\\.(?:png|svg)$",
                "maxLength": 128,
                "minLength": 6
              }
            }
          }
        }
      }
    }
  }
}
