import type { GetStaticProps, InferGetStaticPropsType } from 'next'

import { getGlobalFields } from '@/lib/api/globals'
import { getProductOverviewPage } from '@/lib/api/products'

import OverviewTemplate from '@/components/templates/Overview'

export default function SampleKitsLanding({ page }: InferGetStaticPropsType<typeof getStaticProps>) {
  return <OverviewTemplate page={page} />
}

export const getStaticProps: GetStaticProps = async ({ preview = false }) => {
  const { globals } = await getGlobalFields(preview)
  const { page } = await getProductOverviewPage('sample-kits')

  return {
    props: {
      globals,
      page,
    },
    revalidate: 10, // In seconds
  }
}
