import type { GetStaticPathsContext, GetStaticProps, InferGetStaticPropsType } from 'next'

import { blogGetStaticPathsHelper, blogGetStaticPropsHelper } from '@/lib/getStaticHelpers'

import SinglePostTemplate from '@/components/templates/SinglePost'

export default function NewsSingle({ page, morePosts }: InferGetStaticPropsType<typeof getStaticProps>) {
  return <SinglePostTemplate post={page} morePosts={morePosts} />
}

export const getStaticProps: GetStaticProps = async context => {
  return await blogGetStaticPropsHelper(context)
}

export const getStaticPaths = async (context: GetStaticPathsContext) => {
  return await blogGetStaticPathsHelper(context, 'news')
}
