{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/narrareach-com/json-schema/narrareach-com-stats-insights-response-schema.json",
  "title": "StatsInsightsResponse",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/narrareach-com-openapi.json#/components/schemas/StatsInsightsResponse",
  "type": "object",
  "required": [
    "schemaVersion",
    "generatedAt",
    "scope",
    "outcomes",
    "nicheTiming",
    "audience"
  ],
  "properties": {
    "schemaVersion": {
      "type": "integer",
      "const": 1
    },
    "generatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "scope": {
      "type": "object",
      "additionalProperties": true
    },
    "outcomes": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "id",
          "state",
          "metrics",
          "drivers",
          "evidence"
        ],
        "properties": {
          "id": {
            "type": "string",
            "enum": [
              "audience_growth",
              "reach",
              "traffic_discovery",
              "engagement_quality",
              "conversion_value",
              "publishing_rhythm"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "ready",
              "partial",
              "unavailable",
              "error"
            ]
          },
          "metrics": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "key",
                "label",
                "unit",
                "semantics",
                "current",
                "previous",
                "absoluteChange",
                "percentChange"
              ],
              "properties": {
                "key": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "unit": {
                  "type": "string",
                  "enum": [
                    "count",
                    "percent",
                    "currency_minor",
                    "milliseconds"
                  ]
                },
                "semantics": {
                  "type": "string",
                  "enum": [
                    "period_event",
                    "latest_cumulative_snapshot",
                    "account_total"
                  ]
                },
                "current": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "Null when the value was not measured, never 0 in its place."
                },
                "previous": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "Null when the previous period was not measured."
                },
                "absoluteChange": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "Null unless both current and previous were measured."
                },
                "percentChange": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "Null unless both were measured and previous is not 0."
                }
              }
            }
          },
          "drivers": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true,
              "properties": {
                "contribution": {
                  "type": [
                    "number",
                    "null"
                  ]
                }
              }
            }
          },
          "evidence": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "coverage": {
            "type": "object",
            "additionalProperties": true
          }
        }
      }
    },
    "platformPerformance": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "engagementPeak": {
      "anyOf": [
        {
          "type": "object",
          "additionalProperties": true,
          "required": [
            "basis",
            "hour",
            "weekday",
            "benchmarkHour",
            "benchmarkWeekday",
            "weekdayLabel",
            "displayLabel",
            "engagements",
            "averageEngagements",
            "share",
            "sampleCount"
          ],
          "properties": {
            "basis": {
              "type": "string",
              "const": "measured_scheduled_posts",
              "description": "The peak is measured from the writer's own scheduled posts that have engagement data."
            },
            "hour": {
              "type": "integer",
              "minimum": 0,
              "maximum": 23
            },
            "weekday": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ]
            },
            "benchmarkHour": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 23
                },
                {
                  "type": "null"
                }
              ],
              "description": "The peak hour in America/New_York time, the clock the other-writers timing benchmark uses. hour and weekday are in the writer's own time zone. Null when the peak posts do not agree on one New York hour."
            },
            "benchmarkWeekday": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 6
                },
                {
                  "type": "null"
                }
              ],
              "description": "The peak weekday in America/New_York time (0 is Sunday). Null for an hour-only peak."
            },
            "weekdayLabel": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "displayLabel": {
              "type": "string"
            },
            "engagements": {
              "type": "number"
            },
            "averageEngagements": {
              "type": "number"
            },
            "share": {
              "type": "number"
            },
            "sampleCount": {
              "type": "integer"
            }
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "nicheTiming": {
      "type": "object",
      "required": [
        "title",
        "summary",
        "comparison",
        "alignment",
        "windows"
      ],
      "additionalProperties": false,
      "properties": {
        "title": {
          "type": "string"
        },
        "summary": {
          "type": "string"
        },
        "comparison": {
          "type": "string"
        },
        "alignment": {
          "type": "string",
          "enum": [
            "no_peak",
            "weekend_peak",
            "weekday_reliable",
            "crowded_morning",
            "other"
          ]
        },
        "windows": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "label": {
                "type": "string"
              },
              "window": {
                "type": "string"
              },
              "detail": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "audience": {
      "type": "object",
      "required": [
        "date",
        "subscribers",
        "paidSubscribers",
        "emailOpenRate",
        "arr"
      ],
      "additionalProperties": false,
      "properties": {
        "date": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "subscribers": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "paidSubscribers": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "emailOpenRate": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "arr": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "description": "Annual recurring revenue. Null for non-owners."
        }
      }
    }
  },
  "additionalProperties": false
}