{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://w3id.org/intellicat/caveat/vocabularies/profiles/assessment-1.schema.json",
  "title": "CAVEAT assessment profile, version 1",
  "description": "Structure only. Semantic rules (link/marker agreement, strength bands, stated modes) are enforced by scripts/check_assessment.py.",
  "type": "object",
  "required": ["profile", "caveat_version", "assessments"],
  "additionalProperties": false,
  "properties": {
    "@context": {"type": ["string", "object"]},
    "profile": {"const": "caveat-assessment/1"},
    "caveat_version": {"type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+$"},
    "document": {"type": "string", "format": "uri"},
    "claimed_topic": {"$ref": "#/$defs/oaTopic"},
    "assessments": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/assessment"}}
  },
  "$defs": {
    "curie": {"type": "string", "pattern": "^caveat:[A-Za-z_][A-Za-z0-9_]*$"},
    "oaTopic": {"type": "string", "pattern": "^caveatoa:T\\d+$"},
    "unit": {"type": "number", "minimum": 0, "maximum": 1},
    "detector": {
      "type": "object",
      "required": ["pipeline", "module", "version"],
      "additionalProperties": false,
      "properties": {
        "pipeline": {"type": "string", "minLength": 1},
        "module": {"type": "string", "minLength": 1},
        "version": {"type": "string", "minLength": 1}
      }
    },
    "assessment": {
      "type": "object",
      "required": ["mode", "score", "observations"],
      "additionalProperties": false,
      "properties": {
        "mode": {"$ref": "#/$defs/curie"},
        "score": {"$ref": "#/$defs/unit"},
        "assessed_by": {"$ref": "#/$defs/detector"},
        "observations": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/observation"}}
      }
    },
    "observation": {
      "type": "object",
      "required": ["marker", "link", "confidence", "calibrated", "detector"],
      "additionalProperties": false,
      "properties": {
        "marker": {"$ref": "#/$defs/curie"},
        "link": {"type": "string", "pattern": "^caveat:evidence_[A-Za-z0-9]+_[A-Za-z0-9]+$"},
        "strength": {"$ref": "#/$defs/curie"},
        "confidence": {"$ref": "#/$defs/unit"},
        "calibrated": {"type": "boolean"},
        "intensity": {"$ref": "#/$defs/unit"},
        "stated_mode": {"$ref": "#/$defs/curie"},
        "stated_reason": {"type": "string"},
        "related_document": {"type": "string", "format": "uri"},
        "topic_relation": {"$ref": "#/$defs/curie"},
        "topic_relation_counts": {
          "type": "object",
          "propertyNames": {"pattern": "^caveat:[A-Za-z]+$"},
          "additionalProperties": {"type": "integer", "minimum": 0}
        },
        "locator": {"type": "object"},
        "detector": {"$ref": "#/$defs/detector"}
      }
    }
  }
}
