{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://castles.bussetech.com/schema/claims.schema.json",
  "title": "Count claims",
  "description": "The numbers people actually repeat about castles, each graded by how well it is sourced. Individual records answer 'is this a castle?'; this file answers 'where did that number come from?' — which is the question most castle statistics cannot survive. The grading vocabulary is deliberately about METHOD, not about whether the figure is plausible: a well-sourced number can be wrong and a folkloric one can be roughly right, and conflating the two is how 'France has 45,000 châteaux' became a fact.",
  "type": "object",
  "required": ["version", "claims"],
  "additionalProperties": false,
  "properties": {
    "version": { "const": 1 },
    "claims": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/claim" } }
  },
  "$defs": {
    "claim": {
      "type": "object",
      "required": ["id", "claim", "jurisdiction", "grade", "assessment", "sources", "last_updated"],
      "additionalProperties": false,
      "properties": {
        "id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*[a-z0-9]$" },
        "claim": { "type": "string", "minLength": 1, "description": "The assertion as it actually circulates, in its usual wording." },
        "value": { "type": ["integer", "null"], "description": "The number asserted. Null where the claim is a range or is non-numeric." },
        "value_range": {
          "type": "array",
          "items": { "type": "integer" },
          "minItems": 2,
          "maxItems": 2,
          "description": "[low, high] where the claim circulates as a range. An honest range beats a false integer."
        },
        "definition": { "type": ["string", "null"], "description": "Ref: data/definitions.yml id — which band the claim is really about, where it can be mapped. Null when the claim does not correspond to any band, which is itself a finding." },
        "jurisdiction": { "type": "string" },
        "grade": {
          "enum": ["official", "scholarly", "derived", "circulating", "folklore"],
          "description": "`official`: a named body's own published figure. `scholarly`: named author, disclosed method, datable publication. `derived`: this project re-ran a reproducible query and recorded it. `circulating`: widely repeated with a plausible but unconfirmed origin. `folklore`: no traceable source at all — a round number appearing fully formed, usually in several magnitudes at once."
        },
        "assessment": { "type": "string", "minLength": 1, "description": "What was actually checked, including what could not be verified. The reader should be able to disagree with the grade on the evidence given." },
        "supersedes": { "type": "string", "description": "Ref: another claim id this one corrects." },
        "sources": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": ["url"],
            "additionalProperties": false,
            "properties": {
              "url": { "type": "string", "pattern": "^https?://" },
              "title": { "type": "string" },
              "publisher": { "type": "string" },
              "date": { "type": "string", "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$" },
              "note": { "type": "string" }
            }
          }
        },
        "last_updated": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }
      }
    }
  }
}
