"""
FAQ section component schemas.

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

from pydantic import BaseModel, ConfigDict, Field

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


class FAQItem(BaseModel):
    """
    Individual FAQ item.

    Matches TypeScript:
        interface FAQItem {
            question: string;
            answer: string;
        }
    """

    question: str = Field(..., description="Question text")
    answer: str = Field(..., description="Answer text (can contain HTML)")

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


class FAQSectionProps(BaseModel):
    """
    Base FAQ 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")
    items: list[FAQItem] | None = Field(None, description="List of FAQ items")
    cta: CTAProps | None = Field(None, description="Optional CTA")

    # Contact support section
    support_heading: str | None = Field(
        None,
        serialization_alias="supportHeading",
        description="Support section heading",
    )
    support_text: str | None = Field(None, serialization_alias="supportText", description="Support section text")
    support_cta: CTAProps | None = Field(None, serialization_alias="supportCta", description="Support CTA")

    # Contact link (used by some variants)
    contact_text: str | None = Field(None, serialization_alias="contactText", description="Contact link text")
    contact_href: str | None = Field(None, serialization_alias="contactHref", description="Contact link URL")

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


class FAQAccordion01Props(FAQSectionProps):
    """
    FAQ with accordion layout.
    """

    default_open_index: int | None = Field(
        None,
        serialization_alias="defaultOpenIndex",
        description="Index of FAQ item open by default",
    )
    allow_multiple_open: bool | None = Field(
        False,
        serialization_alias="allowMultipleOpen",
        description="Allow multiple items open at once",
    )


class FAQSimple02Props(FAQSectionProps):
    """
    FAQ with simple two-column layout.
    """

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


__all__ = [
    "FAQItem",
    "FAQSectionProps",
    "FAQAccordion01Props",
    "FAQSimple02Props",
]
