{
  "$schema": "http://json-schema.org/draft-06/schema#",
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "label": {
      "type": "string"
    },
    "version": {
      "type": "integer",
      "default": 1
    },
    "sections": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/sectionConstraint"
      }
    }
  },
  "required": [
    "name",
    "label",
    "version",
    "sections"
  ],
  "definitions": {
    "blockName": {
      "type": "string",
      "pattern": "^[a-z]+(?:-+[a-z]+)*-v\\d+$"
    },
    "blockGroup": {
      "type": "string",
      "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
    },
    "sectionConstraint": {
      "description": "Schema for documenting and validating section constraints",
      "type": "object",
      "properties": {
        "allowedBlocks": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/blockName"
          },
          "minItems": 1
        },
        "deprecatedBlocks": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/blockName"
          },
          "minItems": 1
        },
        "defaultBlocks": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/blockName"
          }
        },
        "allowedBlockGroups": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/blockGroup"
          }
        },
        "min": {
          "type": "number",
          "minimum": 1,
          "maximum": 1000
        },
        "max": {
          "type": "number",
          "minimum": 1,
          "maximum": 1000
        },
        "size": {
          "type": "number",
          "minimum": 1,
          "maximum": 1000
        },
        "optional": {
          "type": "boolean"
        }
      }
    }
  }
}