{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://drole.com/data/content-index-schema.json",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "$schema",
    "version",
    "review_date",
    "scope",
    "content_count",
    "contents"
  ],
  "properties": {
    "$schema": {
      "const": "https://drole.com/data/content-index-schema.json"
    },
    "version": {
      "type": "string"
    },
    "review_date": {
      "type": "string",
      "format": "date"
    },
    "scope": {
      "type": "string",
      "minLength": 50
    },
    "content_count": {
      "type": "integer",
      "minimum": 1
    },
    "contents": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "type",
          "title",
          "mechanism",
          "canonical_url",
          "permalink_url",
          "included_in_pages",
          "related_content_ids",
          "citation_text"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Z]{3}-[0-9]{4}$"
          },
          "type": {
            "type": "string",
            "enum": [
              "blague",
              "devinette",
              "charade",
              "jeu-de-mots",
              "contrepeterie"
            ]
          },
          "title": {
            "type": "string",
            "minLength": 3
          },
          "mechanism": {
            "type": "string",
            "minLength": 5
          },
          "canonical_url": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://drole\\.com/[^#]*$"
          },
          "permalink_url": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://drole\\.com/.+#[A-Z]{3}-[0-9]{4}$"
          },
          "included_in_pages": {
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "format": "uri"
            }
          },
          "related_content_ids": {
            "type": "array",
            "maxItems": 3,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^[A-Z]{3}-[0-9]{4}$"
            }
          },
          "citation_text": {
            "type": "string",
            "minLength": 20
          }
        }
      }
    }
  }
}
