{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://loop.firmiana.si/deprecations/v1/deprecations.schema.json",
  "title": "Loop: LLM model and API deprecations and shutdown dates, from official sources",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema", "version", "generated_at", "license", "today", "vendors", "records"],
  "properties": {
    "schema": { "const": "https://loop.firmiana.si/deprecations/v1/deprecations.schema.json" },
    "version": { "const": 1 },
    "generated_at": { "type": "string", "format": "date-time" },
    "license": { "const": "CC-BY-4.0" },
    "today": { "type": "string", "format": "date", "description": "UTC day the build ran; days_left and status are relative to it" },
    "vendors": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "name", "name_zh", "page", "method", "checked_at", "records"],
        "properties": {
          "id": { "type": "string", "pattern": "^[a-z0-9-]+$" },
          "name": { "type": "string" },
          "name_zh": { "type": "string" },
          "page": { "type": "string", "format": "uri", "description": "Official page or notice list" },
          "method": { "enum": ["automatic", "manual"], "description": "automatic = read daily from the page; manual = entered by hand from official notices" },
          "checked_at": { "type": ["string", "null"], "format": "date" },
          "records": { "type": "integer", "minimum": 0 }
        }
      }
    },
    "records": { "type": "array", "items": { "$ref": "#/$defs/record" } }
  },
  "$defs": {
    "date": { "type": ["string", "null"], "format": "date" },
    "record": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "vendor", "kind", "models", "label", "state", "status", "announced", "shutdown", "precision", "days_left", "replacement", "replacement_text", "note", "source", "first_seen", "checked_at", "unverified"],
      "properties": {
        "id": { "type": "string", "description": "vendor/key, stable" },
        "vendor": { "type": "string" },
        "kind": { "enum": ["model", "feature"] },
        "models": { "type": "array", "items": { "type": "string" } },
        "label": { "type": ["string", "null"] },
        "state": { "enum": ["deprecated", "restricted", "retired"], "description": "The vendor's own state" },
        "status": { "enum": ["upcoming", "past", "tba"], "description": "upcoming = shutdown today or later; past = before today; tba = no date announced" },
        "announced": { "$ref": "#/$defs/date" },
        "shutdown": { "$ref": "#/$defs/date" },
        "precision": { "enum": ["exact", "earliest", "tba"] },
        "days_left": { "type": ["integer", "null"], "description": "shutdown minus today in days (negative when past)" },
        "replacement": { "type": "array", "items": { "type": "string" } },
        "replacement_text": { "type": ["string", "null"] },
        "note": { "type": ["string", "null"] },
        "source": { "type": "string", "format": "uri" },
        "first_seen": { "type": ["string", "null"], "format": "date" },
        "checked_at": { "type": ["string", "null"], "format": "date" },
        "unverified": { "type": "array", "items": { "type": "string" } }
      }
    }
  }
}
