"""Configuration dataclasses for card stack initialization and visual styling."""

# AUTOGENERATED! DO NOT EDIT! File to edit: ../../nbs/core/config.ipynb.

# %% auto #0
__all__ = ['CardStackStyleConfig', 'CardStackConfig']

# %% ../../nbs/core/config.ipynb #b1000003
from dataclasses import dataclass, field
from typing import Tuple

from cjm_fasthtml_tailwind.utilities.effects import shadow
from cjm_fasthtml_tailwind.core.base import combine_classes
from cjm_fasthtml_daisyui.utilities.semantic_colors import shadow_dui
from cjm_fasthtml_daisyui.utilities.border_radius import border_radius

# %% ../../nbs/core/config.ipynb #b1000005
_prefix_counter: int = 0

def _auto_prefix() -> str:  # Unique prefix string (e.g., "cs0", "cs1")
    """Generate an auto-incrementing unique prefix."""
    global _prefix_counter
    p = f"cs{_prefix_counter}"
    _prefix_counter += 1
    return p

def _reset_prefix_counter() -> None:
    """Reset the prefix counter (for testing only)."""
    global _prefix_counter
    _prefix_counter = 0

# %% ../../nbs/core/config.ipynb #gygpoeocu9c
_DEFAULT_FOCUS_SHADOW: str = combine_classes(shadow.lg, shadow_dui.primary)
_DEFAULT_FOCUS_BORDER_RADIUS: str = str(border_radius.box)

# %% ../../nbs/core/config.ipynb #p72afv0hap
@dataclass
class CardStackStyleConfig:
    """Visual styling for a card stack instance."""
    # Spacing (CSS length values — set as CSS custom properties for dynamic JS adjustment)
    section_gap: str = "1rem"           # Gap between cards in each section
    slot_padding: str = "0.25rem"       # Padding around context card content
    viewport_padding_x: str = "0.5rem"  # Horizontal outer container padding
    viewport_padding_y: str = "0.5rem"  # Vertical outer container padding
    focus_padding_x: str = "0.5rem"     # Horizontal focused section padding
    focus_padding_b: str = "1rem"       # Bottom focused section padding

    # Visual emphasis (CSS class strings)
    focus_shadow: str = _DEFAULT_FOCUS_SHADOW                # Shadow classes for focused card
    focus_border_radius: str = _DEFAULT_FOCUS_BORDER_RADIUS  # Border radius class for focused card

    def css_vars_style(
        self,
        prefix: str,  # Card stack instance prefix
    ) -> str:  # Inline style string with CSS custom property declarations
        """Generate CSS custom property declarations as an inline style string."""
        return (
            f"--{prefix}-section-gap: {self.section_gap}; "
            f"--{prefix}-slot-padding: {self.slot_padding}; "
            f"--{prefix}-viewport-padding-x: {self.viewport_padding_x}; "
            f"--{prefix}-viewport-padding-y: {self.viewport_padding_y}; "
            f"--{prefix}-focus-padding-x: {self.focus_padding_x}; "
            f"--{prefix}-focus-padding-b: {self.focus_padding_b}"
        )

# %% ../../nbs/core/config.ipynb #b1000008
@dataclass
class CardStackConfig:
    """Initialization-time settings for a card stack instance."""
    prefix: str = field(default_factory=_auto_prefix)  # HTML ID prefix (auto-generated if omitted)

    # Card count selector options
    visible_count_options: Tuple[int, ...] = (1, 3, 5, 7, 9)  # Choices for card count dropdown
    auto_visible_count: bool = True  # Whether "Auto" option appears in card count dropdown

    # Width slider bounds
    card_width_min: int = 30    # Width slider minimum (rem)
    card_width_max: int = 120   # Width slider maximum (rem)
    card_width_step: int = 5    # Width slider step (rem)

    # Scale slider bounds
    card_scale_min: int = 50    # Scale slider minimum (%)
    card_scale_max: int = 200   # Scale slider maximum (%)
    card_scale_step: int = 10   # Scale slider step (%)

    # Interaction
    click_to_focus: bool = False  # Whether context cards get transparent click overlay
    disable_scroll_in_modes: Tuple[str, ...] = ()  # Mode names where scroll-to-nav is suppressed

    # Visual styling
    style: CardStackStyleConfig = field(default_factory=CardStackStyleConfig)  # Visual styling config
