"""
Blog section component schemas.

Mirrors lightwave-ui/src/components/marketing/blog/.
"""

from pydantic import BaseModel, ConfigDict, Field

from lightwave.schema.pydantic.ui.types import BadgeProps, CTAProps, PersonInfo


class ArticleItem(BaseModel):
    """
    Blog article item.

    Matches TypeScript:
        interface ArticleItem {
            id: string;
            title: string;
            summary: string;
            thumbnail: string;
            href: string;
            author: PersonInfo;
            category?: BadgeProps;
            publishedAt: string;
            readTime?: string;
        }
    """

    id: str = Field(..., description="Article ID")
    title: str = Field(..., description="Article title")
    summary: str = Field(..., description="Article summary/excerpt")
    thumbnail: str = Field(..., description="Thumbnail image URL")
    href: str = Field(..., description="Article URL")
    author: PersonInfo = Field(..., description="Author information")
    category: BadgeProps | None = Field(None, description="Category badge")
    published_at: str = Field(..., serialization_alias="publishedAt", description="Publication date")
    read_time: str | None = Field(None, serialization_alias="readTime", description="Estimated read time")

    model_config = ConfigDict(
        populate_by_name=True,
        extra="forbid",
    )


class BlogSectionProps(BaseModel):
    """
    Base blog section props.
    """

    eyebrow: str | None = Field(None, description="Small text above heading")
    headline: str | None = Field(None, description="Section headline")
    description: str | None = Field(None, description="Section description")
    articles: list[ArticleItem] | None = Field(None, description="List of articles")
    cta: CTAProps | None = Field(None, description="View all CTA")

    model_config = ConfigDict(
        populate_by_name=True,
        extra="forbid",
    )


class BlogSectionSimpleLeftAligned01Props(BlogSectionProps):
    """
    Blog section with simple left-aligned layout.
    """

    columns: int | None = Field(3, description="Number of article columns")


class BlogSectionCarouselLayout02Props(BlogSectionProps):
    """
    Blog section with carousel layout.
    """

    show_carousel_controls: bool | None = Field(
        True,
        serialization_alias="showCarouselControls",
        description="Show carousel nav buttons",
    )
    auto_play: bool | None = Field(False, serialization_alias="autoPlay", description="Auto-advance carousel")


class BlogHeaderFeaturedPost02Props(BlogSectionProps):
    """
    Blog header with featured post.
    """

    featured_article: ArticleItem | None = Field(
        None, serialization_alias="featuredArticle", description="Featured article"
    )


__all__ = [
    "ArticleItem",
    "BlogSectionProps",
    "BlogSectionSimpleLeftAligned01Props",
    "BlogSectionCarouselLayout02Props",
    "BlogHeaderFeaturedPost02Props",
]
