"""
Header navigation component schemas.

Mirrors lightwave-ui/src/components/marketing/header-navigation/.
"""

from typing import Any

from pydantic import BaseModel, ConfigDict, Field

from lightwave.schema.pydantic.ui.types import (
    AuthConfig,
    AuthState,
    FooterNavItem,
)


class HeaderNavItem(BaseModel):
    """
    Header navigation item.

    Matches TypeScript:
        interface HeaderNavItem {
            label: string;
            href?: string;
            menu?: ReactNode;
        }
    """

    label: str = Field(..., description="Nav item label")
    href: str | None = Field(None, description="Nav item link")
    # Note: menu is ReactNode in TS, represented as dict for JSON serialization
    menu: dict[str, Any] | None = Field(None, description="Dropdown menu configuration")

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


class HeaderProps(BaseModel):
    """
    Header component props.

    Matches TypeScript HeaderProps interface from header.tsx.

    Example:
        header_props = HeaderProps(
            brand_name="Acme",
            logo_url="/logo.svg",
            items=[HeaderNavItem(label="Products", href="/products")],
        )
        json_data = header_props.model_dump(by_alias=True)
    """

    # Layout
    is_full_width: bool | None = Field(None, serialization_alias="isFullWidth", description="Full width layout")
    is_floating: bool | None = Field(None, serialization_alias="isFloating", description="Floating header style")
    class_name: str | None = Field(None, serialization_alias="className", description="Additional CSS classes")

    # Logo (URL-based)
    logo_url: str | None = Field(None, serialization_alias="logoUrl", description="Logo image URL")
    logo_minimal_url: str | None = Field(
        None,
        serialization_alias="logoMinimalUrl",
        description="Minimal logo for mobile",
    )
    brand_name: str | None = Field(None, serialization_alias="brandName", description="Brand name for alt text")
    home_url: str | None = Field("/", serialization_alias="homeUrl", description="Home link URL")

    # Navigation
    items: list[HeaderNavItem] | None = Field(None, description="Main navigation items")
    footer_items: list[FooterNavItem] | None = Field(
        None, serialization_alias="footerItems", description="Mobile footer nav items"
    )

    # Auth
    auth_state: AuthState | None = Field(None, serialization_alias="authState", description="Authentication state")
    auth_config: AuthConfig | None = Field(None, serialization_alias="authConfig", description="Auth configuration")

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


__all__ = [
    "HeaderNavItem",
    "HeaderProps",
]
