{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://oerbloei.pages.dev/api/schema.json",
  "title": "Oerbloei plant record",
  "description": "One garden plant scored for the Dutch context. Every score is derived from the plant's facts by published criteria (see score_breakdown). All scores are 0-5 and higher is always better, including maintenance (5 = least work).",
  "type": "object",
  "required": [
    "id",
    "url",
    "name_nl",
    "name_latin",
    "type",
    "native_to_netherlands",
    "scores",
    "score_breakdown",
    "sun",
    "soil",
    "height_cm",
    "flowering",
    "evergreen",
    "attracts",
    "summary_nl",
    "tags",
    "score_source"
  ],
  "additionalProperties": false,
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^[a-z0-9-]+$"
    },
    "url": {
      "type": "string",
      "format": "uri"
    },
    "name_nl": {
      "type": "string",
      "description": "Dutch common name, as a garden centre labels it"
    },
    "name_latin": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "enum": [
        "vaste plant",
        "heester",
        "klimplant",
        "bolgewas",
        "boom",
        "siergras",
        "varen",
        "eenjarige",
        "haagplant",
        "kruid"
      ]
    },
    "native_to_netherlands": {
      "type": "boolean"
    },
    "scores": {
      "type": "object",
      "required": [
        "biodiversity",
        "maintenance",
        "placement",
        "looks",
        "overall"
      ],
      "additionalProperties": false,
      "properties": {
        "biodiversity": {
          "type": "number",
          "minimum": 0,
          "maximum": 5,
          "description": "Biodiversiteit: inheems (1), voedt insecten (2), voedt vogels (1), voedt rupsen (1)"
        },
        "maintenance": {
          "type": "number",
          "minimum": 0,
          "maximum": 5,
          "description": "Onderhoudsgemak: weinig klussen (2), geen plaag (1), blijft op zijn plek (1), blijvend (1)"
        },
        "placement": {
          "type": "number",
          "minimum": 0,
          "maximum": 5,
          "description": "Plaatsing: standplaatsen (3), niet kieskeurig (1), past in een tuin (1)"
        },
        "looks": {
          "type": "number",
          "minimum": 0,
          "maximum": 5,
          "description": "Uitstraling: blikvanger (3), bloeit 3+ maanden (1), ook buiten de bloei (1)"
        },
        "overall": {
          "type": "number",
          "minimum": 0,
          "maximum": 5,
          "description": "unweighted mean of the axis scores"
        }
      }
    },
    "score_breakdown": {
      "type": "array",
      "description": "Per axis: the criteria, the points each earned, and the sum. The score is 5 x earned / max.",
      "items": {
        "type": "object",
        "required": [
          "key",
          "score",
          "earned",
          "max",
          "parts"
        ],
        "properties": {
          "key": {
            "type": "string"
          },
          "score": {
            "type": "number",
            "minimum": 0,
            "maximum": 5
          },
          "earned": {
            "type": "number"
          },
          "max": {
            "type": "number"
          },
          "parts": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "label",
                "points",
                "max"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "points": {
                  "type": "number"
                },
                "max": {
                  "type": "number"
                },
                "detail": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "sun": {
      "type": "array",
      "items": {
        "enum": [
          "zon",
          "halfschaduw",
          "schaduw"
        ]
      }
    },
    "soil": {
      "type": "array",
      "items": {
        "enum": [
          "droog",
          "normaal",
          "vochtig",
          "nat"
        ]
      }
    },
    "height_cm": {
      "type": "object",
      "required": [
        "min",
        "max"
      ],
      "additionalProperties": false,
      "properties": {
        "min": {
          "type": "integer"
        },
        "max": {
          "type": "integer"
        }
      }
    },
    "flowering": {
      "oneOf": [
        {
          "type": "null",
          "description": "grown for foliage or form"
        },
        {
          "type": "object",
          "required": [
            "from_month",
            "to_month",
            "colors"
          ],
          "additionalProperties": false,
          "properties": {
            "from_month": {
              "type": "integer",
              "minimum": 1,
              "maximum": 12
            },
            "to_month": {
              "type": "integer",
              "minimum": 1,
              "maximum": 12
            },
            "colors": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        }
      ]
    },
    "evergreen": {
      "type": "boolean"
    },
    "attracts": {
      "type": "array",
      "items": {
        "enum": [
          "bijen",
          "hommels",
          "vlinders",
          "zweefvliegen",
          "vogels",
          "nachtvlinders"
        ]
      }
    },
    "summary_nl": {
      "type": "string"
    },
    "combines_with": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "ids of plants that pair well"
    },
    "uses": {
      "type": "array",
      "items": {
        "enum": [
          "keuken",
          "thee",
          "eetbaar",
          "geur"
        ]
      },
      "description": "What the plant is picked for, the main use first: keukenkruid, thee, eetbaar, geur. Left out when it has none. Added in 2.1."
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[a-z0-9-]+$"
      }
    },
    "score_source": {
      "enum": [
        "hand",
        "model"
      ],
      "description": "\"hand\" = facts checked one by one. \"model\" = estimated from known traits."
    }
  }
}