""" Trends Module Schemas Pydantic models for request/response """ from pydantic import BaseModel, Field from typing import Optional, List from enum import Enum # =================== # Enums # =================== class CategoryEnum(str, Enum): """Available categories""" all = "all" arts_entertainment = "arts_entertainment" autos_vehicles = "autos_vehicles" beauty_fitness = "beauty_fitness" books_literature = "books_literature" business_industrial = "business_industrial" computers_electronics = "computers_electronics" finance = "finance" food_drink = "food_drink" games = "games" health = "health" hobbies_leisure = "hobbies_leisure" home_garden = "home_garden" internet_telecom = "internet_telecom" jobs_education = "jobs_education" news = "news" science = "science" shopping = "shopping" sports = "sports" travel = "travel" class TimeframeEnum(str, Enum): """Available timeframes""" now_1h = "now_1h" now_4h = "now_4h" now_1d = "now_1d" now_7d = "now_7d" today_1m = "today_1m" today_3m = "today_3m" today_12m = "today_12m" today_5y = "today_5y" class SearchTypeEnum(str, Enum): """Search types""" web = "web" youtube = "youtube" news = "news" images = "images" shopping = "shopping" # =================== # Request Models # =================== class TrendingNowRequest(BaseModel): """Request for trending now""" country: str = Field("united_states", description="Country name (e.g., 'bangladesh', 'india', 'united_states')") limit: int = Field(20, ge=1, le=50, description="Number of results") class KeywordResearchRequest(BaseModel): """Request for keyword research""" keyword: str = Field(..., description="Search keyword") region: str = Field("", description="Region code (empty for worldwide, e.g., 'US', 'BD', 'IN')") timeframe: TimeframeEnum = Field(TimeframeEnum.today_12m, description="Time range") category: CategoryEnum = Field(CategoryEnum.all, description="Category") search_type: SearchTypeEnum = Field(SearchTypeEnum.web, description="Search type") class YouTubeTrendsRequest(BaseModel): """Request for YouTube trends""" keyword: str = Field(..., description="Search keyword") region: str = Field("", description="Region code (empty for worldwide)") timeframe: TimeframeEnum = Field(TimeframeEnum.today_12m, description="Time range") # =================== # Response Models # =================== class TrendingTopic(BaseModel): """Single trending topic""" rank: int topic: str country: str traffic: str = "N/A" class TrendingNowResponse(BaseModel): """Response for trending now""" success: bool count: int trends: List[TrendingTopic] class TopicItem(BaseModel): """Single topic item""" topic: str type: Optional[str] = None value: int class QueryItem(BaseModel): """Single query item""" query: str value: str class RelatedData(BaseModel): """Related topics/queries data""" keyword: str top: List[dict] rising: List[dict] class KeywordResearchResponse(BaseModel): """Response for keyword research""" success: bool keyword: str region: str timeframe: str category: str search_type: str related_topics: dict related_queries: dict