import { playbooksPageMode } from '@/features/playbooks/pageMode';
import { AnalyzeView } from '@/features/playbooks/analytics/AnalyzeViews';
import { PlaybooksListView } from '@/features/playbooks/ui/PlaybooksListView';

export const metadata = { title: 'Playbooks' };

/** PB3: the Playbooks list on the playbooks API; PB5: `?view=analyze` is the native Analyze tab. */
export default async function PlaybooksPage({
  searchParams,
}: {
  searchParams: Promise<Record<string, string | string[] | undefined>>;
}) {
  if (playbooksPageMode(await searchParams) === 'analyze') return <AnalyzeView />;
  return <PlaybooksListView />;
}
