"""Divider primitive: thin horizontal line."""

from __future__ import annotations

import pydivkit as dk

from smarty_ui.tokens.theme import Theme, default_theme


def divider(
    *,
    color: str | None = None,
    margins: dict[str, int] | None = None,
    theme: Theme = default_theme,
) -> dk.DivSeparator:
    """Thin horizontal divider line."""
    m = margins or {}
    edge = dk.DivEdgeInsets(
        left=m.get("left", 0),
        right=m.get("right", 0),
        top=m.get("top", theme.spacing.sm),
        bottom=m.get("bottom", theme.spacing.sm),
    )
    return dk.DivSeparator(
        delimiter_style=dk.DivSeparatorDelimiterStyle(
            color=color or theme.colors.border,
        ),
        width=dk.DivMatchParentSize(),
        margins=edge,
    )
