from __future__ import annotations from typing import Any DETAIL_LEVELS = ("balanced", "concise", "dense") DEFAULT_DETAIL_LEVEL = "balanced" def detail_level_choices() -> list[str]: return list(DETAIL_LEVELS) def normalize_detail_level(value: Any) -> str: level = str(value or "").strip().lower().replace("-", "_").replace(" ", "_") return level if level in DETAIL_LEVELS else DEFAULT_DETAIL_LEVEL def detail_allows(level: Any, dense_only: bool = False) -> bool: level = normalize_detail_level(level) if dense_only: return level == "dense" return level != "concise"