{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://raw.githubusercontent.com/AntiAlienate/knowledge/main/schemas/case-study.schema.json",
  "title": "Case Study File",
  "description": "Structured representation of a parental-alienation judicial decision. The .md sibling is rendered from this JSON at build time. Children and family parties are anonymised per the deciding court's privacy convention.",
  "type": "object",
  "required": ["schema_version", "slug", "caption", "jurisdiction_code", "decision_date", "court", "license", "author", "summary", "holding", "sources"],
  "properties": {
    "schema_version": {"const": "1.0"},
    "slug": {"type": "string", "pattern": "^[a-z0-9-]+$", "description": "URL-safe slug matching the .md/.json filename stem"},
    "caption": {"type": "string", "description": "Full official caption, e.g. 'BVerfG 17.11.2023 – 1 BvR 1076/23' or 'NF v AF [2025] CSOH 13'"},
    "ecli": {"type": "string", "description": "European Case Law Identifier where applicable, e.g. ECLI:DE:BVerfG:2023:rk20231117.1bvr107623"},
    "neutral_citation": {"type": "string", "description": "Court-neutral citation where applicable, e.g. [2025] CSOH 13, [2026] EWFC 38"},
    "jurisdiction_code": {"type": "string", "pattern": "^[A-Z]{2,3}(-[A-Z]{2,3})?$", "description": "ISO 3166-1 alpha-2/3 with optional subdivision: DE, UK-SCO, UK-EWS, BR, IN, etc."},
    "decision_date": {"type": "string", "format": "date"},
    "court": {"type": "string", "description": "Deciding court, e.g. 'Bundesverfassungsgericht (2. Kammer des Ersten Senats)' or 'Court of Session (Outer House)'"},
    "panel": {"type": "string", "description": "Bench composition, e.g. 'Ott / Radtke / Wolff'"},
    "judges": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["name"],
        "properties": {
          "name": {"type": "string"},
          "role": {"type": "string", "description": "e.g. 'Berichterstatter', 'ponente', 'Lord Ordinary'"},
          "url": {"type": "string", "format": "uri"}
        }
      }
    },
    "parties": {
      "type": "object",
      "description": "Anonymised per the deciding court's convention. Do NOT include identifying information for children.",
      "properties": {
        "applicant": {"type": "string", "description": "Anonymised, e.g. 'mother', 'father', 'NF'"},
        "respondent": {"type": "string"},
        "children": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "anonym": {"type": "string", "description": "e.g. 'Kind 1', 'Mary', 'A'"},
              "year_of_birth": {"type": "integer"},
              "sex": {"enum": ["male", "female", "not_stated"]},
              "notes": {"type": "string"}
            }
          }
        }
      }
    },
    "counsel": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["name", "for"],
        "properties": {
          "name": {"type": "string"},
          "role": {"type": "string", "description": "KC, advocate, lay representative, instructed by"},
          "for": {"type": "string", "description": "Which party"},
          "firm": {"type": "string"}
        }
      }
    },
    "experts": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["name"],
        "properties": {
          "name": {"type": "string", "description": "Use 'Sachverständige A' or similar anonymisation where the court did so"},
          "field": {"type": "string", "description": "e.g. 'Chartered Clinical Psychologist', 'Diplom-Psychologin'"},
          "instructed_by": {"type": "string"},
          "practitioner_ref": {"type": "string", "description": "Cross-link to practitioner ID if the expert is in the directory"}
        }
      }
    },
    "procedural_history": {"type": "string"},
    "summary": {"type": "string", "description": "3-4 sentences: why this case matters"},
    "holding": {"type": "string", "description": "The court's ratio decidendi in plain language"},
    "verbatim_quotes": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["text", "language"],
        "properties": {
          "text": {"type": "string"},
          "language": {"type": "string", "description": "ISO 639-1 code"},
          "translation_en": {"type": "string"},
          "paragraph": {"type": "string", "description": "Rn., para., §"},
          "source_url": {"type": "string", "format": "uri"}
        }
      }
    },
    "outcome": {"type": "string", "description": "Operative order: e.g. 'OLG decision annulled, remanded' or 'Residence to defender; no contact'"},
    "comparative_jurisprudence": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["caption"],
        "properties": {
          "caption": {"type": "string"},
          "jurisdiction_code": {"type": "string"},
          "case_study_ref": {"type": "string", "description": "Cross-link slug if we have a case study for it"},
          "relevance": {"type": "string"}
        }
      }
    },
    "subsequent_reception": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "venue": {"type": "string", "description": "Journal, court, body"},
          "citation": {"type": "string"},
          "year": {"type": "integer"},
          "url": {"type": "string", "format": "uri"},
          "summary": {"type": "string"}
        }
      }
    },
    "references": {
      "type": "array",
      "items": {"type": "string", "pattern": "^(case-study|practitioner|jurisdiction|evidence):[a-z0-9.-]+$"},
      "description": "Cross-links to other entities in the knowledge base"
    },
    "sources": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["title", "url"],
        "properties": {
          "title": {"type": "string"},
          "url": {"type": "string", "format": "uri"},
          "publisher": {"type": "string"},
          "language": {"type": "string"},
          "accessed": {"type": "string", "format": "date"},
          "type": {"enum": ["primary-court-text", "court-press-release", "official-database", "journal-article", "news-coverage", "ngo-report", "academic-blog"]}
        }
      }
    },
    "editorial_notes": {
      "type": "array",
      "items": {"type": "string"},
      "description": "What could not be verified from primary text; methodology caveats"
    },
    "word_count": {"type": "integer", "description": "Body wordcount (for editorial budgeting)"},
    "author": {"type": "string", "const": "Alan Markson"},
    "license": {"const": "CC-BY-4.0"}
  }
}
