{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "http://mapeo.world/schemas/preset.json",
  "title": "Preset",
  "description": "Presets define how map entities are displayed to the user. They define the icon used on the map, and the fields / questions shown to the user when they create or edit the entity on the map. The `tags` property of a preset is used to match the preset with observations, nodes, ways and relations. If multiple presets match, the one that matches the most tags is used.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "schemaVersion": {
      "description": "Version of schema. Should increment for breaking changes to the schema",
      "type": "number",
      "minimum": 1,
      "meta:enum": {
        "1": "Current schema version is `1`"
      },
      "enum": [1]
    },
    "id": {
      "description": "Unique value that identifies this element",
      "type": "string"
    },
    "name": {
      "description": "Name for the feature in default language.",
      "type": "string"
    },
    "geometry": {
      "description": "Valid geometry types for the feature - this preset will only match features of this geometry type `\"point\", \"vertex\", \"line\", \"area\", \"relation\"`",
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "enum": ["point", "vertex", "line", "area", "relation"]
      }
    },
    "tags": {
      "description": "The tags are used to match the preset to existing map entities. You can match based on multiple tags E.g. if you have existing points with the tags `nature:tree` and `species:oak` then you can add both these tags here in order to match only oak trees.",
      "type": "object",
      "properties": {},
      "additionalProperties": true
    },
    "addTags": {
      "description": "Tags that are added when changing to the preset (default is the same value as 'tags')",
      "type": "object",
      "properties": {},
      "additionalProperties": true
    },
    "removeTags": {
      "description": "Tags that are removed when changing to another preset (default is the same value as 'addTags' which in turn defaults to 'tags')",
      "type": "object",
      "properties": {},
      "additionalProperties": true
    },
    "fields": {
      "description": "IDs of fields to displayed to the user when the preset is created or edited",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "additionalFields": {
      "description": "Additional fields to display (used internally by Mapeo Desktop, no need to define this in preset)",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "icon": {
      "description": "ID of preset icon which represents this preset",
      "type": "string"
    },
    "terms": {
      "description": "Synonyms or related terms (used for search)",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "sort": {
      "description": "When presets are displayed as a list, defines the order it should be sorted. Presets with lowest sort numbers are displayed first",
      "type": "integer"
    }
  },
  "required": [
    "id",
    "name",
    "geometry",
    "tags"
  ]
}
