"""Resolve the 7-way content dial into an audio source + video on/off (§6). The single source of truth for design §6's table: which audio source plays and whether the projector shows video, for each dial position. """ from __future__ import annotations from dataclasses import dataclass # The four distinct audio sources. "white_noise" is generated at runtime; # "music" is the public-domain classical pool; "audio_track" is the clip's own # field audio; "none" is silence. AUDIO_SOURCES = frozenset({"none", "white_noise", "music", "audio_track"}) @dataclass(frozen=True) class ContentResolution: audio_source: str video: bool # Design §6, one row per dial position. _TABLE = { "off": ContentResolution("none", False), "white_noise": ContentResolution("white_noise", False), "music": ContentResolution("music", False), "audio_track": ContentResolution("audio_track", False), "video": ContentResolution("none", True), "music_video": ContentResolution("music", True), "audio_video": ContentResolution("audio_track", True), } def resolve_content(position: str) -> ContentResolution: """Map a content-dial position to its audio source and video flag (§6).""" try: return _TABLE[position] except KeyError: raise ValueError( f"unknown content position {position!r}; expected one of {sorted(_TABLE)}" ) from None