{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://leid.no/entity-index-schema.json",
  "title": "Leid.no Entity Index",
  "description": "Schema for the machine-readable entity index served at /entity-index.json",
  "type": "object",
  "required": ["version", "site", "language", "description", "count", "entities"],
  "properties": {
    "$schema": {
      "type": "string",
      "format": "uri"
    },
    "version": {
      "type": "string"
    },
    "site": {
      "type": "string",
      "format": "uri"
    },
    "language": {
      "type": "string"
    },
    "license": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "count": {
      "type": "integer",
      "minimum": 0
    },
    "entities": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["title", "slug", "url", "description", "category", "entityType", "date"],
        "properties": {
          "title": { "type": "string" },
          "slug": { "type": "string" },
          "url": { "type": "string", "format": "uri" },
          "description": { "type": "string" },
          "category": { "type": "string" },
          "subcategory": { "type": "string" },
          "topic": { "type": "string" },
          "entityType": {
            "type": "string",
            "enum": ["Product", "Bundle", "Article", "Category", "Page", "WebSite"]
          },
          "aliases": {
            "type": "array",
            "items": { "type": "string" }
          },
          "related": {
            "type": "array",
            "items": { "type": "string" }
          },
          "seeAlso": {
            "type": "array",
            "items": { "type": "string" }
          },
          "date": {
            "type": "string",
            "format": "date"
          }
        }
      }
    }
  }
}
