"""
Modal component schemas.

Mirrors lightwave-ui/src/components/application/modals/.
"""

from typing import Literal

from pydantic import BaseModel, ConfigDict, Field

from lightwave.schema.pydantic.ui.types import CTAProps


class ModalProps(BaseModel):
    """
    Base modal component props.

    Matches TypeScript ModalProps.
    """

    # Content
    title: str | None = Field(None, description="Modal title")
    description: str | None = Field(None, description="Modal description")

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

    # Actions
    primary_cta: CTAProps | None = Field(None, serialization_alias="primaryCta", description="Primary action")
    secondary_cta: CTAProps | None = Field(None, serialization_alias="secondaryCta", description="Secondary action")

    # Behavior
    dismissible: bool = Field(True, description="Can be dismissed by clicking outside")
    show_close_button: bool = Field(True, serialization_alias="showCloseButton", description="Show X button")

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


class ConfirmationModalProps(ModalProps):
    """
    Confirmation dialog modal props.

    Matches TypeScript ConfirmationModalProps.
    """

    # Type
    type: Literal["info", "success", "warning", "danger"] = Field("info", description="Confirmation type")

    # Icon
    icon: str | None = Field(None, description="Custom icon")
    show_icon: bool = Field(True, serialization_alias="showIcon", description="Show type icon")

    # Actions
    confirm_text: str = Field("Confirm", serialization_alias="confirmText", description="Confirm button text")
    cancel_text: str = Field("Cancel", serialization_alias="cancelText", description="Cancel button text")

    # Destructive styling
    is_destructive: bool = Field(
        False,
        serialization_alias="isDestructive",
        description="Use destructive styling for confirm button",
    )


__all__ = [
    "ModalProps",
    "ConfirmationModalProps",
]
