{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://agrodt.github.io/agrotool-knowledge-portal/schemas/v1/topics.schema.json",
  "title": "PublicTopics",
  "type": "array",
  "items": {
    "type": "object",
    "allOf": [
      { "$ref": "common.schema.json#/$defs/recordMetadata" },
      {
        "type": "object",
        "required": [
          "topic_id",
          "parent_topic_id",
          "labels",
          "aliases",
          "definition",
          "component_ids",
          "taxonomy_version",
          "status",
          "source_ids"
        ],
        "properties": {
          "topic_id": { "type": "string", "pattern": "^T[A-Z0-9_-]{3,63}$" },
          "parent_topic_id": {
            "type": ["string", "null"],
            "pattern": "^T[A-Z0-9_-]{3,63}$"
          },
          "labels": { "$ref": "common.schema.json#/$defs/localizedText" },
          "aliases": {
            "type": "array",
            "items": { "type": "string" },
            "uniqueItems": true
          },
          "definition": { "$ref": "common.schema.json#/$defs/localizedText" },
          "component_ids": {
            "type": "array",
            "items": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
            "uniqueItems": true
          },
          "taxonomy_version": {
            "type": "string",
            "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
          },
          "status": { "enum": ["curated", "provisional"] },
          "source_ids": { "$ref": "common.schema.json#/$defs/sourceIds" }
        }
      }
    ],
    "unevaluatedProperties": false
  }
}
