import { useParams } from 'react-router';
import { DEFAULT_TRANSMISSION_SECTION, isTransmissionSection, type TransmissionSectionId } from './shared';

// The URL names the open section — not a panel channel. See docs/navigation-audit.md. TransmissionScreen
// redirects anything unrecognised, so the fallback here only covers the instant before that lands.

export function useTransmissionSection(): TransmissionSectionId {
  const { section } = useParams();
  return isTransmissionSection(section) ? section : DEFAULT_TRANSMISSION_SECTION;
}
