{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://cognitive-biases.github.io/schemas/monthly-research-digests.schema.json",
  "title": "Cognitive Biases monthly research digests",
  "description": "Public evidence-delta updates that connect newly reviewed research to canonical guidance without treating recency as scientific certainty.",
  "type": "object",
  "additionalProperties": false,
  "required": ["version", "updatedAt", "digests"],
  "properties": {
    "version": { "const": 1 },
    "updatedAt": { "type": "string", "format": "date" },
    "digests": {
      "type": "array",
      "items": { "$ref": "#/$defs/digest" }
    }
  },
  "$defs": {
    "digest": {
      "type": "object",
      "additionalProperties": false,
      "required": ["slug", "month", "title", "publishedAt", "summary", "editorialNote", "takeaways", "signals", "whatChanged", "nextQuestions"],
      "properties": {
        "slug": { "type": "string", "pattern": "^\\d{4}-\\d{2}$" },
        "month": { "type": "string", "minLength": 4, "maxLength": 40 },
        "title": { "type": "string", "minLength": 5, "maxLength": 200 },
        "publishedAt": { "type": "string", "format": "date" },
        "summary": { "type": "string", "minLength": 20, "maxLength": 160 },
        "editorialNote": { "type": "string", "minLength": 20, "maxLength": 1000 },
        "takeaways": {
          "type": "array",
          "minItems": 3,
          "items": { "type": "string", "minLength": 10, "maxLength": 500 }
        },
        "signals": {
          "type": "array",
          "minItems": 3,
          "items": { "$ref": "#/$defs/signal" }
        },
        "whatChanged": {
          "type": "array",
          "minItems": 1,
          "items": { "type": "string", "minLength": 10, "maxLength": 500 }
        },
        "nextQuestions": {
          "type": "array",
          "minItems": 1,
          "items": { "type": "string", "minLength": 10, "maxLength": 500 }
        }
      }
    },
    "signal": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "title", "delta", "confidence", "sourceStatus", "finding", "whyItMatters", "practicalCheck", "siteAction", "source"],
      "properties": {
        "id": { "type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" },
        "title": { "type": "string", "minLength": 5, "maxLength": 200 },
        "delta": { "enum": ["strengthens", "narrows", "new context", "watch only"] },
        "confidence": { "enum": ["strong", "moderate", "provisional"] },
        "sourceStatus": { "type": "string", "minLength": 3, "maxLength": 200 },
        "finding": { "type": "string", "minLength": 20, "maxLength": 2000 },
        "whyItMatters": { "type": "string", "minLength": 20, "maxLength": 1500 },
        "practicalCheck": { "type": "string", "minLength": 10, "maxLength": 1000 },
        "siteAction": { "type": "string", "minLength": 10, "maxLength": 1000 },
        "source": { "$ref": "#/$defs/source" }
      },
      "allOf": [
        {
          "if": { "properties": { "delta": { "const": "watch only" } }, "required": ["delta"] },
          "then": { "properties": { "confidence": { "const": "provisional" } } }
        }
      ]
    },
    "source": {
      "type": "object",
      "additionalProperties": false,
      "required": ["title", "publishedAt", "url"],
      "properties": {
        "title": { "type": "string", "minLength": 5, "maxLength": 500 },
        "publishedAt": { "type": "string", "format": "date" },
        "doi": { "type": "string", "minLength": 5, "maxLength": 300 },
        "url": { "type": "string", "format": "uri", "pattern": "^https://" }
      }
    }
  }
}
