{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/narrareach-com/json-schema/narrareach-com-topic-suggestions-schema.json",
  "title": "TopicSuggestions",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/narrareach-com-openapi.json#/components/schemas/TopicSuggestions",
  "type": "object",
  "required": [
    "pillars",
    "recommendations",
    "emptyReason",
    "region",
    "sources",
    "fetchedAt"
  ],
  "properties": {
    "pillars": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "name",
          "source",
          "topicCount"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "content_tag",
              "profile_theme"
            ]
          },
          "topicCount": {
            "type": "integer"
          }
        }
      }
    },
    "recommendations": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "topic",
          "pillar",
          "fit",
          "matchedTerms",
          "momentum",
          "momentumPct",
          "firstSeenAt",
          "whyNow",
          "suggestedAngle",
          "sources",
          "links",
          "network",
          "signals",
          "whyItWorks"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "topic": {
            "type": "string"
          },
          "pillar": {
            "type": "object",
            "required": [
              "id",
              "name"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "fit": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "How squarely it sits in the pillar, how strongly it is trending, and how it did for writers."
          },
          "matchedTerms": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "momentum": {
            "type": "string",
            "enum": [
              "new",
              "rising",
              "steady",
              "cooling"
            ]
          },
          "momentumPct": {
            "type": [
              "number",
              "null"
            ]
          },
          "firstSeenAt": {
            "type": "string",
            "format": "date-time"
          },
          "whyNow": {
            "type": "string"
          },
          "suggestedAngle": {
            "type": "string"
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "source",
                "url",
                "rank",
                "volume"
              ],
              "properties": {
                "source": {
                  "type": "string",
                  "enum": [
                    "SUBSTACK",
                    "BLUESKY",
                    "X",
                    "GOOGLE_TRENDS",
                    "HACKER_NEWS",
                    "GOOGLE_NEWS",
                    "REDDIT"
                  ]
                },
                "url": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "rank": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "volume": {
                  "type": [
                    "number",
                    "null"
                  ]
                }
              }
            }
          },
          "links": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "title",
                "url"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          },
          "network": {
            "type": [
              "object",
              "null"
            ],
            "description": "How posts about the topic did across Narrareach writers, when known.",
            "properties": {
              "writers": {
                "type": "number"
              },
              "posts": {
                "type": "number"
              },
              "platforms": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "engagementLift": {
                "type": [
                  "number",
                  "null"
                ]
              }
            }
          },
          "signals": {
            "type": "object",
            "required": [
              "nicheResponse",
              "pillarStrength",
              "nicheGroup"
            ],
            "description": "Evidence that the topic is likely to work for this writer. Each part is null when there is not enough data.",
            "properties": {
              "nicheResponse": {
                "type": [
                  "object",
                  "null"
                ],
                "description": "A Reddit thread or X post compared with the usual response for that source in the writer's niche.",
                "properties": {
                  "source": {
                    "type": "string",
                    "enum": [
                      "REDDIT",
                      "X",
                      "SUBSTACK"
                    ]
                  },
                  "engagement": {
                    "type": "number"
                  },
                  "typical": {
                    "type": "number"
                  },
                  "multiple": {
                    "type": "number"
                  }
                }
              },
              "pillarStrength": {
                "type": [
                  "object",
                  "null"
                ],
                "description": "The pillar's rank by average engagement among the writer's measured pillars (1 is their best).",
                "properties": {
                  "rank": {
                    "type": "integer"
                  },
                  "of": {
                    "type": "integer"
                  }
                }
              },
              "nicheGroup": {
                "type": [
                  "object",
                  "null"
                ],
                "description": "How posts on similar topics did for other writers in the writer's niche group: the median of each writer's engagement against their own usual (1 is usual). The writer is never counted. label is the group's name, or null when it has none or when scope is nearby_groups (the group had too few measured writers, so similar niches were used).",
                "properties": {
                  "label": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "writers": {
                    "type": "integer"
                  },
                  "lift": {
                    "type": "number"
                  },
                  "scope": {
                    "type": "string",
                    "enum": [
                      "group",
                      "nearby_groups"
                    ]
                  }
                }
              }
            }
          },
          "whyItWorks": {
            "type": [
              "string",
              "null"
            ],
            "description": "The signals in one plain sentence, or null when none is strong enough to mention."
          }
        }
      }
    },
    "emptyReason": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "no_pillars",
        "unknown_pillar",
        "no_profile",
        "check_unavailable",
        "refreshing",
        "no_trends",
        "no_matches",
        null
      ],
      "description": "Why recommendations is empty: no_pillars (no themes or used tags), unknown_pillar, no_profile (no niche on the writer profile), check_unavailable (try again later), refreshing (call again in about 30 seconds), no_trends, no_matches."
    },
    "region": {
      "type": "string"
    },
    "sources": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "source",
          "lastCollectedAt"
        ],
        "properties": {
          "source": {
            "type": "string"
          },
          "lastCollectedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    },
    "fetchedAt": {
      "type": "string",
      "format": "date-time"
    }
  }
}