"""
Pricing section component schemas.

Mirrors lightwave-ui/src/components/marketing/pricing-sections/.
"""

from pydantic import BaseModel, ConfigDict, Field

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


class PricingFeature(BaseModel):
    """
    Feature included in a pricing tier.
    """

    text: str = Field(..., description="Feature description")
    included: bool = Field(True, description="Whether feature is included")
    tooltip: str | None = Field(None, description="Tooltip explanation")

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


class PricingTierProps(BaseModel):
    """
    Individual pricing tier/plan.

    Matches TypeScript:
        interface PricingTierProps {
            name: string;
            price: string;
            priceMonthly?: string;
            priceAnnual?: string;
            pricePeriod?: string;
            description?: string;
            features: PricingFeature[];
            cta?: CTAProps;
            highlighted?: boolean;
            badge?: string;
        }
    """

    name: str = Field(..., description="Tier name")
    price: str = Field(..., description="Display price")
    price_monthly: str | None = Field(None, serialization_alias="priceMonthly", description="Monthly price")
    price_annual: str | None = Field(None, serialization_alias="priceAnnual", description="Annual price")
    price_period: str | None = Field(
        None,
        serialization_alias="pricePeriod",
        description="Price period (e.g., '/month')",
    )
    description: str | None = Field(None, description="Tier description")
    features: list[PricingFeature] = Field(default_factory=list, description="List of features")
    cta: CTAProps | None = Field(None, description="CTA button")
    highlighted: bool = Field(False, description="Highlight this tier")
    badge: str | None = Field(None, description="Badge text (e.g., 'Most Popular')")

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


class PricingSectionProps(BaseModel):
    """
    Base pricing 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")
    tiers: list[PricingTierProps] | None = Field(None, description="List of pricing tiers")

    # Billing toggle
    show_billing_toggle: bool | None = Field(
        False,
        serialization_alias="showBillingToggle",
        description="Show monthly/annual toggle",
    )
    default_billing: str | None = Field(
        "monthly",
        serialization_alias="defaultBilling",
        description="Default billing period",
    )
    annual_discount: str | None = Field(
        None,
        serialization_alias="annualDiscount",
        description="Annual discount text (e.g., 'Save 20%')",
    )

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


class PricingSectionFeaturedCards01Props(PricingSectionProps):
    """
    Pricing with featured card layout.
    """

    featured_tier_index: int | None = Field(
        1,
        serialization_alias="featuredTierIndex",
        description="Index of featured/highlighted tier",
    )


class PricingPrimaryCardSimpleProps(PricingSectionProps):
    """
    Pricing with simple primary card.
    """

    pass


class PricingSimpleAccentLineProps(PricingSectionProps):
    """
    Pricing with accent line decoration.
    """

    accent_color: str | None = Field(None, serialization_alias="accentColor", description="Accent line color")


class PricingAbstractAnglesProps(PricingSectionProps):
    """
    Pricing with abstract angle background.
    """

    background_style: str | None = Field(None, serialization_alias="backgroundStyle", description="Background style")


__all__ = [
    "PricingFeature",
    "PricingTierProps",
    "PricingSectionProps",
    "PricingSectionFeaturedCards01Props",
    "PricingPrimaryCardSimpleProps",
    "PricingSimpleAccentLineProps",
    "PricingAbstractAnglesProps",
]
