import { pageTypeOf } from '@/features/meetings/scheduler';
import { SchedulingPageEditor } from '@/features/meetings/ui/scheduler/SchedulingPageEditor';

export const metadata = {
  title: 'Create scheduling page',
};

/**
 * QA #344: create a scheduling page (design create-meeting.php, full window without the
 * sidebar). `?type=` is the type chosen in "Choose a scheduling page type": one-on-one, group or
 * round-robin.
 */
export default async function NewSchedulingPage({
  searchParams,
}: {
  searchParams: Promise<{ type?: string | string[] }>;
}) {
  const { type } = await searchParams;
  return <SchedulingPageEditor newType={pageTypeOf(Array.isArray(type) ? type[0] : type)} />;
}
