{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/antismi-media/json-schema/antismi-media-trends-request-schema.json",
  "title": "TrendsRequest",
  "description": "Запрос на получение трендов",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/antismi-media-openapi.json#/components/schemas/TrendsRequest",
  "properties": {
    "start_date": {
      "type": "string",
      "format": "date-time",
      "title": "Start Date",
      "description": "Начальная дата"
    },
    "end_date": {
      "type": "string",
      "format": "date-time",
      "title": "End Date",
      "description": "Конечная дата"
    },
    "granularity": {
      "type": "string",
      "title": "Granularity",
      "description": "Гранулярность: day, 3days, week, month",
      "default": "day"
    },
    "categories": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Categories",
      "description": "Список категорий"
    },
    "telegram_id": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Telegram Id",
      "description": "Telegram ID пользователя (legacy)"
    },
    "user_id": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "User Id",
      "description": "Surrogate user ID"
    },
    "limit": {
      "type": "integer",
      "title": "Limit",
      "description": "Количество топ трендов",
      "default": 10
    },
    "mode": {
      "type": "string",
      "title": "Mode",
      "description": "Режим отбора топ-N: 'general' — по абсолютной сумме упоминаний, 'trends' — по z-score относительно предшествующего периода той же длины (выделяет характерные для периода события, подавляет фон).",
      "default": "general"
    },
    "lang": {
      "type": "string",
      "enum": [
        "ru",
        "en"
      ],
      "title": "Lang",
      "description": "Язык метаданных: en → заголовки/резюме/понятия из *_en с fallback на русский (миграция 030)",
      "default": "ru"
    }
  },
  "type": "object",
  "required": [
    "start_date",
    "end_date"
  ]
}