"""Tmux detection and pane information providers."""

from ..models import Context
from .state import DetectionState


def get_tmux_hint(mode: str = "reference") -> str | None:
    """Get activation hint for tmux detector."""
    if mode == "reference":
        return "Running inside tmux"
    return None


def detect_tmux(state: DetectionState) -> Context | None:
    """Detect tmux multiplexer.

    Also provides pane_content and pane_command for other detectors.

    Args:
        state: Detection state with environment

    Returns:
        Tmux context if detected
    """
    if not state.env.tmux_session:
        return None

    if state.env.pane_id:
        state.get("pane_content", lambda env: env.get_pane_content())
        state.get("pane_command", lambda env: env.pane_command or "")

    return Context(
        name="tmux",
        type="multiplexer",
        priority=0,
        sheet="tmux",
        metadata={"pane": state.env.pane_id},
    )
