{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://loop.firmiana.si/news/v1/news.schema.json",
  "title": "News items and change log (news.json, changes.json, and every section's news-items.json)",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema", "version", "generated_at", "license", "items"],
  "properties": {
    "schema": { "type": "string", "format": "uri" },
    "version": { "const": 1 },
    "generated_at": { "type": "string", "format": "date-time" },
    "license": { "const": "CC-BY-4.0" },
    "description": { "type": "string" },
    "items": { "type": "array", "items": { "$ref": "#/$defs/item" } }
  },
  "$defs": {
    "link": {
      "type": "object",
      "additionalProperties": false,
      "required": ["label", "url"],
      "properties": { "label": { "type": "string" }, "url": { "type": "string", "format": "uri" } }
    },
    "item": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "type", "title", "summary", "provider", "published_at", "source_url", "links", "status"],
      "properties": {
        "id": { "type": "string", "minLength": 3, "description": "Stable and unique across the site, '<section>:<type>:<subject>[:<date>]'" },
        "type": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9-]*$",
          "description": "new-model, price-change, upcoming-price, removed, deprecation, platform-listing, plan-change, incident-opened, incident-resolved, release-note, discussion, event, or a type added by another section"
        },
        "title": { "type": "string", "minLength": 1, "description": "One line. English, or the source's own language for posts" },
        "title_zh": { "type": ["string", "null"] },
        "summary": { "type": ["string", "null"], "description": "One or two sentences: plain facts, or the source's own short description. Never article text" },
        "summary_zh": { "type": ["string", "null"] },
        "provider": { "type": ["string", "null"], "description": "Provider id as used in prices/ and status/ (openai, anthropic, …)" },
        "published_at": { "type": "string", "format": "date-time", "description": "When it happened or was first seen (UTC)" },
        "source_url": { "type": ["string", "null"], "format": "uri" },
        "links": { "type": "array", "items": { "$ref": "#/$defs/link" } },
        "status": { "enum": ["confirmed", "unconfirmed", null], "description": "unconfirmed: a new model seen only on catalogues or forums, not yet on an official source" },
        "metrics": { "type": ["object", "null"], "description": "Type-specific details, for example old and new prices" }
      }
    }
  }
}
