{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://xleitstelle.usercontent.opencode.de/xmas-core/rules/style/rules.schema.json",
  "$defs": {
    "StyleRule": {
      "additionalProperties": false,
      "description": "One `stylesheetId`: what it stands for and when it applies.",
      "properties": {
        "comment": {
          "description": "Which Planzeichen the rule represents, or another note for whoever reads the file.",
          "title": "Comment",
          "type": "string"
        },
        "versions": {
          "patternProperties": {
            "^\\d+\\.\\d+$": {
              "$ref": "#/$defs/VersionedStyleRule"
            }
          },
          "title": "Versions",
          "type": "object"
        }
      },
      "required": [
        "comment",
        "versions"
      ],
      "title": "StyleRule",
      "type": "object"
    },
    "StyleSelector": {
      "additionalProperties": false,
      "description": "What one attribute referenced by `art` has to be.",
      "properties": {
        "value": {
          "description": "The values it may hold, or `[\"*\"]` for any value.",
          "items": {
            "type": "string"
          },
          "title": "Value",
          "type": "array"
        },
        "type": {
          "description": "Its type name in the version at hand.",
          "title": "Type",
          "type": "string"
        }
      },
      "required": [
        "value",
        "type"
      ],
      "title": "StyleSelector",
      "type": "object"
    },
    "VersionedStyleRule": {
      "additionalProperties": false,
      "description": "A style rule as it applies to one XPlanung version.",
      "properties": {
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A template for `schriftinhalt`, with the selected attributes as placeholders.",
          "title": "Text"
        },
        "selector": {
          "additionalProperties": {
            "$ref": "#/$defs/StyleSelector"
          },
          "description": "Keyed by attribute: `art` has to reference exactly these. A rule with no selector\nmatches nothing.",
          "title": "Selector",
          "type": "object"
        }
      },
      "required": [
        "selector"
      ],
      "title": "VersionedStyleRule",
      "type": "object"
    }
  },
  "additionalProperties": {
    "$ref": "#/$defs/StyleRule"
  },
  "description": "The rule file: every style rule, keyed by the `stylesheetId` it assigns.",
  "propertyNames": {
    "format": "uuid"
  },
  "title": "XPlanung style rules",
  "type": "object"
}
