{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://click-dog.com/schemas/analysis-notification-v1.schema.json",
  "title": "Click-Dog Analysis Notification Summary",
  "description": "Bounded privacy-reviewed summary consumed by analysis notification destinations.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "report_schema_version",
    "window",
    "highest_eligible_severity",
    "total_finding_counts",
    "new_finding_counts",
    "eligible_finding_count",
    "included_finding_count",
    "truncated_finding_count",
    "conditions"
  ],
  "properties": {
    "schema_version": { "const": "analysis.notification.v1" },
    "report_schema_version": { "enum": ["analysis.report.v1", "analysis.report.v2"] },
    "window": { "$ref": "analysis-report-v1.schema.json#/$defs/window" },
    "highest_eligible_severity": { "enum": ["critical", "warning"] },
    "total_finding_counts": { "$ref": "#/$defs/severity_counts" },
    "new_finding_counts": { "$ref": "#/$defs/severity_counts" },
    "eligible_finding_count": { "type": "integer", "minimum": 1 },
    "included_finding_count": { "type": "integer", "minimum": 1, "maximum": 20 },
    "truncated_finding_count": { "type": "integer", "minimum": 0 },
    "conditions": {
      "type": "array",
      "minItems": 1,
      "maxItems": 20,
      "items": { "$ref": "#/$defs/condition" }
    }
  },
  "$defs": {
    "severity_counts": {
      "type": "object",
      "additionalProperties": false,
      "required": ["critical", "warning", "info"],
      "properties": {
        "critical": { "type": "integer", "minimum": 0 },
        "warning": { "type": "integer", "minimum": 0 },
        "info": { "type": "integer", "minimum": 0 }
      }
    },
    "condition": {
      "type": "object",
      "additionalProperties": false,
      "required": ["condition_key", "analyzer", "severity", "new"],
      "properties": {
        "condition_key": {
          "type": "string",
          "pattern": "^analysis\\.condition\\.v1:[0-9a-f]{24}$"
        },
        "analyzer": { "type": "string", "minLength": 1 },
        "severity": { "enum": ["critical", "warning"] },
        "new": { "type": "boolean" },
        "family_id": { "type": "string", "minLength": 1 },
        "normalized_query_hashes": {
          "type": "array",
          "maxItems": 10,
          "items": { "type": "string", "pattern": "^[1-9][0-9]*$" }
        },
        "hashes_truncated": { "type": "integer", "minimum": 1 }
      }
    }
  }
}
