"""
Button component schemas.

Mirrors lightwave-ui/src/components/base/buttons/.
"""

from typing import Literal

from pydantic import BaseModel, ConfigDict, Field


class ButtonProps(BaseModel):
    """
    Button component props.

    Matches TypeScript ButtonProps from button.tsx.

    Example:
        button = ButtonProps(
            size="lg",
            color="primary",
            is_disabled=False,
        )
        # Serialize to JSON for TypeScript
        json_data = button.model_dump(by_alias=True)
        # {"size": "lg", "color": "primary", "isDisabled": false}
    """

    # Size variant
    size: Literal["sm", "md", "lg", "xl"] = Field("sm", description="Button size")

    # Color variant
    color: Literal[
        "primary",
        "secondary",
        "tertiary",
        "link-gray",
        "link-color",
        "primary-destructive",
        "secondary-destructive",
        "tertiary-destructive",
        "link-destructive",
    ] = Field("primary", description="Button color variant")

    # State
    is_disabled: bool = Field(False, serialization_alias="isDisabled", description="Disabled state")
    is_loading: bool = Field(False, serialization_alias="isLoading", description="Loading state")

    # Icons
    icon_leading: str | None = Field(None, serialization_alias="iconLeading", description="Leading icon name")
    icon_trailing: str | None = Field(None, serialization_alias="iconTrailing", description="Trailing icon name")

    # Link
    href: str | None = Field(None, description="Link URL (renders as anchor)")

    # Additional
    no_text_padding: bool | None = Field(
        None,
        serialization_alias="noTextPadding",
        description="Remove horizontal text padding",
    )
    show_text_while_loading: bool | None = Field(
        None,
        serialization_alias="showTextWhileLoading",
        description="Keep text visible while loading",
    )

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


__all__ = [
    "ButtonProps",
]
