{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "base",
  "type": "object",
  "required": ["type", "schemaVersion", "title", "slug", "date"],
  "properties": {
    "type": { "type": "string" },
    "schemaVersion": { "type": "integer", "minimum": 1 },
    "title": { "type": "string", "minLength": 1 },
    "slug": { "type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" },
    "date": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" },
    "updated": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" },
    "tags": { "type": "array", "items": { "type": "string" } },
    "summary": { "type": "string" },
    "seo": { "type": "object", "properties": { "description": { "type": "string" }, "image": { "type": "string" }, "noindex": { "type": "boolean" } } },
    "draft": { "type": "boolean" },
    "body": { "type": "array", "items": { "$ref": "base#/$defs/block" } },
    "appearance": {
      "type": "object",
      "properties": {
        "background": { "$ref": "enums#/$defs/background" },
        "surface": { "$ref": "enums#/$defs/surface" },
        "layout": { "$ref": "enums#/$defs/layout" },
        "fx": { "type": "array", "items": { "$ref": "enums#/$defs/fxEffect" } },
        "bgImage": { "type": "string" }
      }
    }
  },
  "$defs": {
    "sources": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["platform", "url"],
        "properties": {
          "platform": { "$ref": "enums#/$defs/platform" },
          "url": { "type": "string" },
          "embedUrl": { "type": ["string", "null"] },
          "primary": { "type": "boolean" }
        }
      }
    },
    "block": {
      "type": "object",
      "required": ["block"],
      "discriminator": { "propertyName": "block" },
      "oneOf": [
        { "properties": { "block": { "const": "hero" }, "image": { "type": "string" }, "headline": { "type": "string" }, "alt": { "type": "string" }, "kicker": { "type": "string" }, "tagline": { "type": "string" }, "sub": { "type": "string" } }, "required": ["block"] },
        { "properties": { "block": { "const": "prose" }, "markdown": { "type": "string" } }, "required": ["block", "markdown"] },
        { "properties": { "block": { "const": "audioEmbed" }, "src": { "type": "string" }, "title": { "type": "string" }, "sources": { "$ref": "base#/$defs/sources" } }, "required": ["block"] },
        { "properties": { "block": { "const": "pullQuote" }, "text": { "type": "string" }, "cite": { "type": "string" } }, "required": ["block", "text"] },
        { "properties": { "block": { "const": "image" }, "src": { "type": "string" }, "alt": { "type": "string" }, "caption": { "type": "string" }, "width": { "type": "integer" }, "height": { "type": "integer" } }, "required": ["block", "src", "alt"] },
        { "properties": { "block": { "const": "code" }, "lang": { "type": "string" }, "content": { "type": "string" } }, "required": ["block", "content"] },
        { "properties": { "block": { "const": "figure" }, "src": { "type": "string" }, "alt": { "type": "string" }, "caption": { "type": "string" }, "credit": { "type": "string" }, "width": { "enum": ["text", "wide", "bleed"] }, "ratio": { "enum": ["16x9", "21x9", "4x3", "1x1"] } }, "required": ["block", "src", "alt"] },
        { "properties": { "block": { "const": "signalChain" }, "title": { "type": "string" }, "steps": { "type": "array", "items": { "type": "object", "required": ["name"], "properties": { "name": { "type": "string" }, "detail": { "type": "string" }, "role": { "type": "string" } } } } }, "required": ["block", "steps"] },
        { "properties": { "block": { "const": "statBand" }, "intro": { "type": "string" }, "stats": { "type": "array", "items": { "type": "object", "required": ["value", "label"], "properties": { "value": { "type": "string" }, "label": { "type": "string" }, "unit": { "type": "string" }, "note": { "type": "string" } } } } }, "required": ["block", "stats"] },
        { "properties": { "block": { "const": "sectionDivider" }, "eyebrow": { "type": "string" }, "title": { "type": "string" }, "dek": { "type": "string" } }, "required": ["block"] },
        { "properties": { "block": { "const": "sectionBreakdown" }, "track": { "type": "string" }, "rows": { "type": "array", "items": { "type": "object", "required": ["section"], "properties": { "at": { "type": "string" }, "section": { "type": "string" }, "meter": { "type": "string" }, "note": { "type": "string" } } } } }, "required": ["block", "rows"] },
        { "properties": { "block": { "const": "abCompare" }, "prompt": { "type": "string" }, "a": { "type": "object", "properties": { "label": { "type": "string" }, "sources": { "$ref": "base#/$defs/sources" } } }, "b": { "type": "object", "properties": { "label": { "type": "string" }, "sources": { "$ref": "base#/$defs/sources" } } } }, "required": ["block", "a", "b"] }
      ]
    }
  }
}
