{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://thruput.se/agents/schemas/governance/taxonomy.schema.json",
  "title": "Taxonomy",
  "description": "A classification scheme: a hierarchy of levels, each a definition with criteria for what belongs to it",
  "type": "object",
  "properties": {
    "levels": {
      "$ref": "#/$defs/Levels"
    }
  },
  "required": [
    "levels"
  ],
  "$defs": {
    "Levels": {
      "description": "The root level first, then every level below it in the order of the parent chain",
      "type": "array",
      "minItems": 1,
      "prefixItems": [
        {
          "$ref": "#/$defs/RootLevel"
        }
      ],
      "items": {
        "$ref": "#/$defs/Level"
      }
    },
    "RootLevel": {
      "description": "A level is a definition; the root level is one with nothing above it",
      "$ref": "definitions.schema.json#/$defs/Definition"
    },
    "Level": {
      "description": "A level below the root: a root level extended with its parent",
      "$ref": "#/$defs/RootLevel",
      "properties": {
        "parent": {
          "$ref": "#/$defs/ParentLevel"
        }
      },
      "required": [
        "parent"
      ]
    },
    "ParentLevel": {
      "description": "The id of the level directly above",
      "$dynamicRef": "id.schema.json#Id"
    }
  },
  "examples": [
    {
      "levels": [
        {
          "id": "Example root level",
          "specification": "The level with nothing above it."
        },
        {
          "id": "Example child level",
          "specification": "A level one step below the root.",
          "parent": "Example root level"
        }
      ]
    }
  ]
}
