{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://thossullivan.github.io/model-eol/schema/0.1/model-eol.alert.schema.json",
  "title": "model-eol alert output",
  "description": "Machine-readable alert payload emitted by `model-eol alert --json`.",
  "type": "object",
  "required": ["schema", "generated", "threshold_days", "scope", "scan_notes", "errors", "warnings"],
  "properties": {
    "schema": { "const": "model-eol/alert@0.1" },
    "generated": { "type": "string", "format": "date-time" },
    "threshold_days": { "type": "integer", "minimum": 0 },
    "distributor": { "type": ["string", "null"], "minLength": 1 },
    "scope": { "enum": ["all", "direct"] },
    "scan_notes": { "type": "array", "items": { "$ref": "https://thossullivan.github.io/model-eol/schema/0.1/model-eol.inventory.schema.json#/definitions/scanNote" } },
    "errors": { "type": "array", "items": { "$ref": "https://thossullivan.github.io/model-eol/schema/0.1/model-eol.inventory.schema.json#/definitions/modelReference" } },
    "warnings": {
      "type": "array",
      "items": {
        "oneOf": [
          { "$ref": "https://thossullivan.github.io/model-eol/schema/0.1/model-eol.inventory.schema.json#/definitions/modelReference" },
          { "$ref": "#/definitions/candidateWarning" },
          { "$ref": "#/definitions/integrationWarning" }
        ]
      }
    }
  },
  "additionalProperties": false,
  "definitions": {
    "candidateWarning": {
      "type": "object",
      "required": ["file", "line", "kind", "matched", "usage", "resolved_provider", "confidence", "evidence", "reason", "status"],
      "properties": {
        "file": { "type": "string", "minLength": 1 },
        "line": { "type": "integer", "minimum": 1 },
        "kind": { "const": "candidate-model-reference" },
        "matched": { "type": "string", "minLength": 1 },
        "usage": { "$ref": "https://thossullivan.github.io/model-eol/schema/0.1/model-eol.inventory.schema.json#/definitions/usage" },
        "resolved_provider": { "type": "string", "minLength": 1 },
        "confidence": { "$ref": "https://thossullivan.github.io/model-eol/schema/0.1/model-eol.inventory.schema.json#/definitions/confidence" },
        "evidence": { "type": "string", "minLength": 1 },
        "effective_scope": { "enum": ["all", "direct"] },
        "policy_provenance": { "$ref": "https://thossullivan.github.io/model-eol/schema/0.1/model-eol.inventory.schema.json#/definitions/policyProvenance" },
        "reason": { "type": "string", "minLength": 1 },
        "status": { "const": "unknown" }
      },
      "additionalProperties": false
    },
    "integrationWarning": {
      "type": "object",
      "required": ["file", "line", "kind", "usage", "provider", "matched", "evidence", "status"],
      "properties": {
        "file": { "type": "string", "minLength": 1 },
        "line": { "type": "integer", "minimum": 1 },
        "kind": { "const": "integration-hint" },
        "usage": { "enum": ["direct-api", "cloud-provider", "gateway"] },
        "provider": { "type": "string", "minLength": 1 },
        "matched": { "type": "string", "minLength": 1 },
        "evidence": { "type": "string", "minLength": 1 },
        "status": { "const": "unresolved" }
      },
      "additionalProperties": false
    }
  }
}
