{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schema.contextura.io/bouwdoos/1.json",
  "title": "Contextura Bouwdoos: apps/<id>.yaml",
  "type": "object",
  "properties": {
    "bouwdoos": {
      "type": "number",
      "const": 1
    },
    "titel": {
      "type": "string",
      "minLength": 1,
      "maxLength": 40
    },
    "kleur": {
      "default": "indigo",
      "type": "string",
      "enum": [
        "amber",
        "teal",
        "groen",
        "indigo",
        "blauw",
        "roos",
        "fuchsia",
        "oranje",
        "paars",
        "grijs"
      ]
    },
    "beeld": {
      "type": "string",
      "pattern": "^[a-z-]{1,30}$"
    },
    "bron": {
      "default": {
        "soort": "eigen"
      },
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "soort": {
              "type": "string",
              "const": "eigen"
            }
          },
          "required": [
            "soort"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "soort": {
              "type": "string",
              "const": "brain"
            },
            "pad": {
              "type": "string",
              "pattern": "^[\\w-]+(\\/[\\w.-]+)*\\.ya?ml$"
            },
            "schrijven": {
              "default": false,
              "type": "boolean"
            }
          },
          "required": [
            "soort",
            "pad"
          ],
          "additionalProperties": false
        }
      ]
    },
    "weergave": {
      "type": "object",
      "properties": {
        "soort": {
          "type": "string",
          "enum": [
            "lijst",
            "checklist",
            "teller",
            "meter",
            "tijdlijn",
            "tabel",
            "grafiek"
          ]
        },
        "velden": {
          "minItems": 1,
          "maxItems": 8,
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,29}$"
          }
        },
        "datum": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_]{0,29}$"
        },
        "elke": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 1,
              "maximum": 3650
            },
            {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,29}$"
            }
          ]
        },
        "waarde": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_]{0,29}$"
        },
        "max": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "eenheid": {
          "type": "string",
          "maxLength": 20
        }
      },
      "required": [
        "soort",
        "velden"
      ],
      "additionalProperties": false
    },
    "acties": {
      "default": [],
      "maxItems": 3,
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "afvinken",
          "toevoegen",
          "ophogen"
        ]
      }
    },
    "wie": {
      "default": "eigenaar",
      "type": "string",
      "const": "eigenaar"
    }
  },
  "required": [
    "bouwdoos",
    "titel",
    "weergave"
  ],
  "additionalProperties": false
}
