from __future__ import annotations

ALLOWED_CODECS = frozenset({"pcm_s16le", "pcm_f32le"})


def validate_start_payload(sample_rate: int, channels: int, codec: str) -> tuple[bool, str | None]:
    if sample_rate < 8000 or sample_rate > 48000:
        return False, "invalid_sample_rate"
    if channels not in (1, 2):
        return False, "invalid_channels"
    if codec not in ALLOWED_CODECS:
        return False, "invalid_codec"
    return True, None

