import { RootPage, generatePageMetadata } from '@payloadcms/next/views';
import config from '../../../../payload.config';
import { importMap } from '../importMap';

export const dynamic = 'force-dynamic';

type PayloadRouteParams = {
  segments?: string[];
};

type PayloadRouteSearchParams = {
  [key: string]: string | string[] | undefined;
};

type Props = {
  params: PayloadRouteParams;
  searchParams: PayloadRouteSearchParams;
};

export const generateMetadata = ({ params, searchParams }: Props) => {
  return generatePageMetadata({
    config,
    params,
    searchParams,
  });
};

export default function Page({ params, searchParams }: Props) {
  return RootPage({
    config,
    importMap,
    params,
    searchParams,
  });
}
