{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/antismi-media/json-schema/antismi-media-digest-request-schema.json",
  "title": "DigestRequest",
  "description": "Запрос на создание дайджеста",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/antismi-media-openapi.json#/components/schemas/DigestRequest",
  "properties": {
    "date": {
      "type": "string",
      "format": "date-time",
      "title": "Date",
      "description": "Дата дайджеста"
    },
    "period": {
      "allOf": [
        {
          "$ref": "#/$defs/DigestPeriod"
        }
      ],
      "description": "Период дня",
      "default": "all"
    },
    "categories": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Categories",
      "description": "Список категорий (если не указан - все доступные)"
    },
    "sentiment_filter": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Sentiment Filter",
      "description": "Фильтр сентимента: all или positive",
      "default": "all"
    },
    "clustering_threshold": {
      "type": "number",
      "title": "Clustering Threshold",
      "description": "Порог для кластеризации",
      "default": 0.25
    },
    "limit": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Limit",
      "description": "Максимальное количество кластеров на категорию (если не указан - все кластеры)"
    },
    "sources_filter": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Sources Filter",
      "description": "Фильтр источников: all или allowed_only",
      "default": "all"
    },
    "media_types": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Media Types",
      "description": "Список типов медиа (Foreign, Independents, State, Neutral, Non-political)"
    },
    "exclude_media_types": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Exclude Media Types",
      "description": "Типы медиа для исключения из выборки. None → применяется серверный дефолт (['State']); пустой список → без исключений"
    },
    "include_rss": {
      "type": "boolean",
      "title": "Include Rss",
      "description": "Показывать новости из RSS-источников (url не t.me и news_date >= 2026-03-16). False — только Telegram-лента",
      "default": true
    },
    "timezone": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Timezone",
      "description": "IANA timezone пользователя для корректного определения границ периода",
      "default": "UTC"
    },
    "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 (используется веб-интерфейсом)"
    },
    "period_end": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Period End",
      "description": "Конец периода для кастомных дайджестов (например, /today)"
    },
    "generated_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Generated At",
      "description": "Время генерации оригинального дайджеста (для фильтрации поздних новостей при повторном запросе)"
    },
    "skip_user_digest_update": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Skip User Digest Update",
      "description": "Пропустить обновление user_digest (для cache scheduler)",
      "default": false
    },
    "lang": {
      "type": "string",
      "enum": [
        "ru",
        "en"
      ],
      "title": "Lang",
      "description": "Язык метаданных: en → заголовки/резюме/понятия из *_en с fallback на русский (миграция 030)",
      "default": "ru"
    }
  },
  "type": "object",
  "required": [
    "date"
  ],
  "$defs": {
    "DigestPeriod": {
      "type": "string",
      "enum": [
        "all",
        "morning",
        "day",
        "evening",
        "night"
      ],
      "title": "DigestPeriod",
      "description": "Периоды дайджестов"
    }
  }
}