{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://islamic-academy.local/schema/knowledge_import_v1.schema.json",
  "title": "Islamic Academy knowledge import v1",
  "description": "One JSON file describes ONE source document and everything extracted from it. Records refer to each other with temporary identifiers (temp_id) that are unique inside the file; the importer replaces them with permanent database identifiers. Version 1.1 adds source_inventory (every reference in the source accounted for), quote context/origin, and evidence_assessments (how scholars accept or reject each piece of evidence).",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "document",
    "topics"
  ],
  "properties": {
    "schema_version": {
      "enum": [
        "1.0",
        "1.1"
      ],
      "description": "Use \"1.1\". Files declaring \"1.0\" are still accepted, but the 1.1 completeness rules are then only warnings."
    },
    "document": {
      "$ref": "#/$defs/document"
    },
    "content_blocks": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/content_block"
      },
      "default": []
    },
    "topics": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/topic"
      }
    },
    "people": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/person"
      },
      "default": []
    },
    "works": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/work"
      },
      "default": []
    },
    "citations": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/citation"
      },
      "default": []
    },
    "quotes": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/quote"
      },
      "default": []
    },
    "hadiths": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/hadith"
      },
      "default": []
    },
    "quran_verses": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/quran_verse"
      },
      "default": []
    },
    "claims": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/claim"
      },
      "default": []
    },
    "review_flags": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/review_flag"
      },
      "default": []
    },
    "source_inventory": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/source_mention"
      },
      "default": [],
      "description": "Required in 1.1: one entry for EVERY scholar, book, hadith, report, verse, dream or other authority the source mentions, each mapped to the records created for it."
    },
    "evidence_assessments": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/evidence_assessment"
      },
      "default": [],
      "description": "How named scholars accept, qualify or reject a piece of evidence AS EVIDENCE FOR A TOPIC — including the opposing side the source itself may not mention."
    }
  },
  "$defs": {
    "temp_id": {
      "type": "string",
      "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
      "description": "Temporary identifier, unique within this file, e.g. \"p1\", \"w_bukhari\", \"h3\"."
    },
    "ref": {
      "type": "string",
      "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,63}$",
      "description": "The temp_id of another record in this file."
    },
    "opt_string": {
      "type": [
        "string",
        "null"
      ]
    },
    "opt_int": {
      "type": [
        "integer",
        "null"
      ]
    },
    "position": {
      "enum": [
        "supporting",
        "opposing",
        "neutral",
        "general",
        "unresolved"
      ],
      "description": "For a DEBATED topic (one with a proposition): supporting / opposing / neutral. For a topic that is not a matter of disagreement (e.g. \"Morning adhkar\", \"Zakat on gold\"): general — the source simply covers it. Use \"unresolved\" when the position cannot be responsibly identified — never use neutral or general to express uncertainty."
    },
    "confidence": {
      "enum": [
        "high",
        "medium",
        "low"
      ]
    },
    "verification_status": {
      "enum": [
        "unverified",
        "partially_verified",
        "verified",
        "disputed"
      ]
    },
    "document": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "temp_id",
        "title",
        "document_type",
        "summary"
      ],
      "properties": {
        "temp_id": {
          "$ref": "#/$defs/temp_id"
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "subtitle": {
          "$ref": "#/$defs/opt_string"
        },
        "document_type": {
          "enum": [
            "article",
            "book",
            "book_chapter",
            "research_paper",
            "fatwa",
            "lecture",
            "tafsir",
            "hadith_commentary",
            "encyclopedia_entry",
            "website",
            "research_notes",
            "other"
          ]
        },
        "authors": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "person"
            ],
            "properties": {
              "person": {
                "$ref": "#/$defs/ref"
              },
              "role": {
                "enum": [
                  "author",
                  "editor",
                  "translator",
                  "compiler"
                ]
              }
            }
          },
          "description": "Authors of THIS document (references to people[])."
        },
        "publisher": {
          "$ref": "#/$defs/opt_string"
        },
        "publication_date": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$",
          "description": "YYYY, YYYY-MM or YYYY-MM-DD exactly as known. Omit if unknown."
        },
        "language": {
          "type": [
            "string",
            "null"
          ],
          "description": "ISO 639-1 code, e.g. en, ar, ur."
        },
        "url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "doi": {
          "$ref": "#/$defs/opt_string"
        },
        "isbn": {
          "$ref": "#/$defs/opt_string"
        },
        "accessed_date": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
        },
        "original_reference": {
          "$ref": "#/$defs/opt_string",
          "description": "The bibliographic reference exactly as supplied by the user / publication."
        },
        "summary": {
          "type": "string",
          "minLength": 20,
          "description": "Original neutral summary written by the extractor (not copied text)."
        },
        "keywords": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "description": "Index keywords (English and/or transliterated Arabic terms)."
        },
        "rights": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "status": {
              "enum": [
                "unknown",
                "permitted",
                "public_domain",
                "restricted"
              ]
            },
            "notes": {
              "$ref": "#/$defs/opt_string"
            }
          }
        }
      }
    },
    "content_block": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "temp_id",
        "order",
        "block_type",
        "text"
      ],
      "properties": {
        "temp_id": {
          "$ref": "#/$defs/temp_id"
        },
        "order": {
          "type": "integer",
          "minimum": 0
        },
        "block_type": {
          "enum": [
            "heading",
            "paragraph",
            "excerpt",
            "quote",
            "list",
            "note"
          ]
        },
        "heading_level": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 2,
          "maximum": 4
        },
        "text": {
          "type": "string",
          "minLength": 1
        },
        "language": {
          "$ref": "#/$defs/opt_string"
        },
        "direction": {
          "enum": [
            "ltr",
            "rtl"
          ]
        },
        "is_verbatim_excerpt": {
          "type": "boolean",
          "description": "true when text is copied verbatim from the source (subject to republication rights)."
        }
      }
    },
    "topic": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "temp_id",
        "title",
        "identification"
      ],
      "properties": {
        "temp_id": {
          "$ref": "#/$defs/temp_id"
        },
        "title": {
          "type": "string",
          "minLength": 3,
          "description": "Subject title as a noun phrase, never a question: \"Witr prayer\", \"Ruling on Witr\", \"Number of rak'at in Witr\". Sub-topic titles must make sense on their own (not just \"Ruling\")."
        },
        "slug_suggestion": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
        },
        "question": {
          "type": [
            "string",
            "null"
          ],
          "description": "Optional. Topics are titled as subjects; use this only to explain the issue in question form."
        },
        "proposition": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 5,
          "description": "Required when the document takes a supporting or opposing position: the statement positions are measured against, e.g. \"Witr is obligatory (wajib).\" Broad subjects have none."
        },
        "aliases": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "transliterations": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "title_arabic": {
          "$ref": "#/$defs/opt_string"
        },
        "category": {
          "type": [
            "string",
            "null"
          ],
          "description": "Subject category path, e.g. \"Fiqh > Prayer\"."
        },
        "subtopics": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "keywords": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "description": {
          "type": [
            "string",
            "null"
          ],
          "description": "Neutral introductory description of the topic (not of the document)."
        },
        "identification": {
          "enum": [
            "explicit",
            "inferred"
          ],
          "description": "explicit = the source names the topic; inferred = deduced by the extractor."
        },
        "inference_basis": {
          "type": [
            "string",
            "null"
          ],
          "description": "Required when identification is inferred: why the topic was inferred."
        },
        "position": {
          "$ref": "#/$defs/position",
          "description": "This document's position on the topic. Omit for a parent subject that is listed only to place sub-topics in the tree. A source that only describes the subject in general is neutral."
        },
        "position_explanation": {
          "type": [
            "string",
            "null"
          ],
          "description": "Why the document takes this position on this topic."
        },
        "qualifications": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Conditions, exceptions and caveats the document attaches to its position."
        },
        "confidence": {
          "$ref": "#/$defs/confidence"
        },
        "parent": {
          "$ref": "#/$defs/ref",
          "description": "temp_id of the broader subject in this file (e.g. \"Ruling on Witr\" → parent \"Witr prayer\"). List the parent subject too, without a position."
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "identification": {
                "const": "inferred"
              }
            }
          },
          "then": {
            "required": [
              "inference_basis"
            ],
            "properties": {
              "inference_basis": {
                "type": "string",
                "minLength": 5
              }
            }
          }
        }
      ]
    },
    "person": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "temp_id",
        "name",
        "person_type"
      ],
      "properties": {
        "temp_id": {
          "$ref": "#/$defs/temp_id"
        },
        "name": {
          "type": "string",
          "minLength": 2,
          "description": "Most common scholarly transliteration, e.g. \"Muhammad ibn Isma'il al-Bukhari\"."
        },
        "name_arabic": {
          "$ref": "#/$defs/opt_string"
        },
        "aliases": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Other names: \"Imam al-Bukhari\", \"al-Bukhari\" …"
        },
        "citation_name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Name as it should appear in a bibliography (e.g. \"al-Nawawi, Y. ibn S.\"). Omit if not known."
        },
        "kunya": {
          "$ref": "#/$defs/opt_string"
        },
        "laqab": {
          "$ref": "#/$defs/opt_string"
        },
        "nisba": {
          "$ref": "#/$defs/opt_string"
        },
        "birth_year_ah": {
          "$ref": "#/$defs/opt_int"
        },
        "birth_year_ce": {
          "$ref": "#/$defs/opt_int"
        },
        "death_year_ah": {
          "$ref": "#/$defs/opt_int"
        },
        "death_year_ce": {
          "$ref": "#/$defs/opt_int"
        },
        "madhhab": {
          "$ref": "#/$defs/opt_string"
        },
        "person_type": {
          "enum": [
            "prophet",
            "companion",
            "successor",
            "scholar",
            "narrator",
            "modern_scholar",
            "author",
            "other"
          ]
        },
        "description": {
          "$ref": "#/$defs/opt_string"
        },
        "roles_in_document": {
          "type": "array",
          "items": {
            "enum": [
              "author",
              "quoted",
              "compiler",
              "narrator",
              "grader",
              "commentator",
              "position_reported",
              "mentioned"
            ]
          }
        }
      }
    },
    "work": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "temp_id",
        "title",
        "work_type"
      ],
      "properties": {
        "temp_id": {
          "$ref": "#/$defs/temp_id"
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "title_arabic": {
          "$ref": "#/$defs/opt_string"
        },
        "alt_titles": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "work_type": {
          "enum": [
            "book",
            "hadith_collection",
            "tafsir",
            "fiqh_manual",
            "commentary",
            "article",
            "journal_article",
            "website",
            "other"
          ]
        },
        "contributors": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "person",
              "role"
            ],
            "properties": {
              "person": {
                "$ref": "#/$defs/ref"
              },
              "role": {
                "enum": [
                  "author",
                  "compiler",
                  "editor",
                  "translator",
                  "commentator",
                  "abridger"
                ]
              }
            }
          }
        },
        "publisher": {
          "$ref": "#/$defs/opt_string"
        },
        "publication_year": {
          "$ref": "#/$defs/opt_int"
        },
        "publication_place": {
          "$ref": "#/$defs/opt_string"
        },
        "edition": {
          "$ref": "#/$defs/opt_string"
        },
        "volumes": {
          "$ref": "#/$defs/opt_string"
        },
        "isbn": {
          "$ref": "#/$defs/opt_string"
        },
        "doi": {
          "$ref": "#/$defs/opt_string"
        },
        "url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "numbering_system": {
          "type": [
            "string",
            "null"
          ],
          "description": "Hadith collections: the numbering system used for hadith_number values (e.g. \"sunnah.com\", \"Fath al-Bari\", \"Abd al-Baqi\")."
        }
      }
    },
    "citation": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "temp_id",
        "original_reference"
      ],
      "properties": {
        "temp_id": {
          "$ref": "#/$defs/temp_id"
        },
        "work": {
          "$ref": "#/$defs/ref",
          "description": "temp_id of the cited work (works[])."
        },
        "original_reference": {
          "type": "string",
          "minLength": 1,
          "description": "The reference exactly as it appears in the source."
        },
        "volume": {
          "$ref": "#/$defs/opt_string"
        },
        "page": {
          "$ref": "#/$defs/opt_string"
        },
        "chapter": {
          "$ref": "#/$defs/opt_string"
        },
        "section": {
          "$ref": "#/$defs/opt_string"
        },
        "hadith_number": {
          "$ref": "#/$defs/opt_string"
        },
        "numbering_system": {
          "$ref": "#/$defs/opt_string"
        },
        "edition": {
          "$ref": "#/$defs/opt_string"
        },
        "url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "block": {
          "$ref": "#/$defs/ref",
          "description": "content_block where the citation appears."
        },
        "verification_status": {
          "$ref": "#/$defs/verification_status"
        }
      }
    },
    "quote": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "temp_id",
        "speaker",
        "text",
        "quote_type"
      ],
      "properties": {
        "temp_id": {
          "$ref": "#/$defs/temp_id"
        },
        "speaker": {
          "$ref": "#/$defs/ref",
          "description": "The person who SAID/WROTE the words (people[]). A hadith compiler is NOT the speaker of the hadiths he compiled — record those in hadiths[]."
        },
        "text": {
          "type": "string",
          "minLength": 3,
          "description": "Quotation text (usually the English translation)."
        },
        "text_original": {
          "$ref": "#/$defs/opt_string"
        },
        "original_language": {
          "$ref": "#/$defs/opt_string"
        },
        "translation_language": {
          "$ref": "#/$defs/opt_string"
        },
        "translator": {
          "$ref": "#/$defs/opt_string"
        },
        "quote_type": {
          "enum": [
            "direct",
            "paraphrase"
          ],
          "description": "direct = exact words. paraphrase only when the exact words cannot be found anywhere — then add a review_flag."
        },
        "work": {
          "$ref": "#/$defs/ref",
          "description": "The speaker's work the words come from, when known."
        },
        "citation": {
          "$ref": "#/$defs/ref"
        },
        "block": {
          "$ref": "#/$defs/ref"
        },
        "topics": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ref"
          }
        },
        "speaker_positions": {
          "type": "array",
          "description": "The SPEAKER'S OWN position on a topic. Only allowed when context.relevance is \"direct\" — a general statement applied by the source is NOT the scholar's position on the topic.",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "topic",
              "position"
            ],
            "properties": {
              "topic": {
                "$ref": "#/$defs/ref"
              },
              "position": {
                "$ref": "#/$defs/position"
              }
            }
          }
        },
        "usage": {
          "type": "array",
          "description": "How THIS DOCUMENT uses the quote (may differ from the speaker's own view).",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "topic"
            ],
            "properties": {
              "topic": {
                "$ref": "#/$defs/ref"
              },
              "used_for": {
                "$ref": "#/$defs/position"
              },
              "how_used": {
                "$ref": "#/$defs/opt_string"
              }
            }
          }
        },
        "origin": {
          "$ref": "#/$defs/origin"
        },
        "context": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "subject",
            "relevance",
            "statement_type"
          ],
          "description": "Required in 1.1. The context in which the SCHOLAR said this — not how the source uses it.",
          "properties": {
            "subject": {
              "type": "string",
              "minLength": 5,
              "description": "What the scholar was actually discussing in the passage (e.g. \"the virtue of loving the Prophet, in his commentary on Bukhari's Kitab al-Iman\")."
            },
            "relevance": {
              "enum": [
                "direct",
                "applied",
                "incidental"
              ],
              "description": "direct = the scholar is addressing this very topic; applied = a general statement that the SOURCE applies to this topic; incidental = a passing remark of little weight for this topic."
            },
            "statement_type": {
              "enum": [
                "ruling",
                "preference",
                "report_of_others",
                "passing_remark",
                "conditional",
                "anecdote_or_dream",
                "other"
              ],
              "description": "ruling = his own considered ruling; preference = his tarjih among views; report_of_others = he is relaying someone else's view; passing_remark; conditional = valid only under stated conditions; anecdote_or_dream."
            },
            "surrounding_text": {
              "type": [
                "string",
                "null"
              ],
              "description": "Short excerpt from around the quote that shows its context."
            },
            "note": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        }
      }
    },
    "hadith": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "temp_id",
        "collection",
        "hadith_number"
      ],
      "properties": {
        "temp_id": {
          "$ref": "#/$defs/temp_id"
        },
        "collection": {
          "$ref": "#/$defs/ref",
          "description": "temp_id of a works[] entry with work_type hadith_collection."
        },
        "hadith_number": {
          "type": "string",
          "minLength": 1,
          "description": "Exactly as given in the source. Never guess."
        },
        "numbering_system": {
          "$ref": "#/$defs/opt_string"
        },
        "alt_numbers": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "system",
              "number"
            ],
            "properties": {
              "system": {
                "type": "string"
              },
              "number": {
                "type": "string"
              }
            }
          }
        },
        "book_name": {
          "$ref": "#/$defs/opt_string"
        },
        "chapter_name": {
          "$ref": "#/$defs/opt_string"
        },
        "narrators": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "person"
            ],
            "properties": {
              "person": {
                "$ref": "#/$defs/ref"
              },
              "role": {
                "enum": [
                  "companion",
                  "narrator",
                  "transmitter"
                ]
              }
            }
          }
        },
        "chain_text": {
          "$ref": "#/$defs/opt_string"
        },
        "text": {
          "type": [
            "string",
            "null"
          ],
          "description": "Translation of the matn as quoted in the source. Never reconstruct missing wording."
        },
        "text_arabic": {
          "$ref": "#/$defs/opt_string"
        },
        "text_is_excerpt": {
          "type": "boolean"
        },
        "gradings": {
          "type": "array",
          "description": "Authenticity assessments REPORTED in the source. Omit if the source gives none.",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "grade"
            ],
            "properties": {
              "grader": {
                "$ref": "#/$defs/ref"
              },
              "grade": {
                "type": "string",
                "minLength": 2,
                "description": "e.g. sahih, hasan, da'if, hasan sahih, mawdu'"
              },
              "note": {
                "$ref": "#/$defs/opt_string"
              },
              "citation": {
                "$ref": "#/$defs/ref"
              }
            }
          }
        },
        "cross_references": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "hadith"
            ],
            "properties": {
              "hadith": {
                "$ref": "#/$defs/ref"
              }
            }
          }
        },
        "topics": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ref"
          }
        },
        "citation": {
          "$ref": "#/$defs/ref"
        },
        "how_used": {
          "$ref": "#/$defs/opt_string"
        }
      }
    },
    "quran_verse": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "temp_id",
        "surah",
        "ayah_start"
      ],
      "properties": {
        "temp_id": {
          "$ref": "#/$defs/temp_id"
        },
        "surah": {
          "type": "integer",
          "minimum": 1,
          "maximum": 114
        },
        "ayah_start": {
          "type": "integer",
          "minimum": 1
        },
        "ayah_end": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 1
        },
        "arabic_text": {
          "$ref": "#/$defs/opt_string"
        },
        "translation": {
          "$ref": "#/$defs/opt_string"
        },
        "translation_source": {
          "$ref": "#/$defs/opt_string"
        },
        "topics": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ref"
          }
        },
        "citation": {
          "$ref": "#/$defs/ref"
        },
        "how_used": {
          "$ref": "#/$defs/opt_string"
        }
      }
    },
    "claim": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "temp_id",
        "statement"
      ],
      "properties": {
        "temp_id": {
          "$ref": "#/$defs/temp_id"
        },
        "topic": {
          "$ref": "#/$defs/ref"
        },
        "statement": {
          "type": "string",
          "minLength": 5
        },
        "position": {
          "$ref": "#/$defs/position"
        },
        "block": {
          "$ref": "#/$defs/ref"
        },
        "evidence": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "enum": [
                  "quote",
                  "hadith",
                  "quran",
                  "citation",
                  "reasoning"
                ]
              },
              "ref": {
                "$ref": "#/$defs/ref"
              },
              "note": {
                "$ref": "#/$defs/opt_string"
              }
            }
          }
        }
      }
    },
    "review_flag": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "severity",
        "message"
      ],
      "properties": {
        "target": {
          "$ref": "#/$defs/ref"
        },
        "field": {
          "$ref": "#/$defs/opt_string"
        },
        "severity": {
          "enum": [
            "info",
            "warning",
            "critical"
          ]
        },
        "message": {
          "type": "string",
          "minLength": 3
        }
      }
    },
    "origin": {
      "enum": [
        "source_document",
        "research"
      ],
      "description": "source_document = the words/claim appear in the source being imported; research = located by you in another work because the source only referred to it (a citation with an exact locator is then required)."
    },
    "source_mention": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "mention",
        "kind"
      ],
      "properties": {
        "mention": {
          "type": "string",
          "minLength": 2,
          "description": "How the source mentions it, copied verbatim (e.g. \"Ibn Hajar\", \"(Bukhari)\", \"Remind them of the Days of God\")."
        },
        "kind": {
          "enum": [
            "scholar",
            "book",
            "hadith",
            "athar",
            "quran_verse",
            "dream_or_vision",
            "historical_report",
            "consensus_claim",
            "other"
          ]
        },
        "recorded_as": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ref"
          },
          "description": "temp_ids of the records that capture this mention (person, work, quote, hadith, quran_verse, citation, claim)."
        },
        "not_recorded_reason": {
          "type": [
            "string",
            "null"
          ],
          "description": "Required when recorded_as is empty: why it could not be recorded."
        }
      }
    },
    "evidence_assessment": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "temp_id",
        "topic",
        "evidence",
        "assessor",
        "stance",
        "grounds",
        "origin"
      ],
      "properties": {
        "temp_id": {
          "$ref": "#/$defs/temp_id"
        },
        "topic": {
          "$ref": "#/$defs/ref",
          "description": "The topic for which the evidence is being assessed."
        },
        "evidence": {
          "$ref": "#/$defs/ref",
          "description": "The hadith, quran_verse, quote or claim being assessed as evidence."
        },
        "assessor": {
          "$ref": "#/$defs/ref",
          "description": "The scholar who makes the assessment (people[])."
        },
        "stance": {
          "enum": [
            "accepts",
            "qualifies",
            "rejects"
          ],
          "description": "accepts = valid evidence for the topic; qualifies = valid only partly / under conditions; rejects = not valid evidence for this topic."
        },
        "grounds": {
          "type": "array",
          "minItems": 1,
          "items": {
            "enum": [
              "direct_text",
              "analogy",
              "general_not_specific",
              "not_relevant_to_topic",
              "different_interpretation",
              "weak_chain",
              "not_a_hadith",
              "dream_not_evidence",
              "practice_of_salaf_absent",
              "contradicted_by_stronger_evidence",
              "abrogated",
              "other"
            ]
          }
        },
        "statement": {
          "$ref": "#/$defs/ref",
          "description": "quotes[] entry holding the assessor's EXACT words (with its own context and citation)."
        },
        "counter_evidence": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ref"
          },
          "description": "hadiths[] / quran_verses[] the assessor cites against using this evidence."
        },
        "origin": {
          "$ref": "#/$defs/origin"
        },
        "note": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  }
}