import { ImageResponse } from 'next/og';
import { getTranslations } from 'next-intl/server';
import { OGImageTemplate } from '@/components/OGImageTemplate';
import { getOgFonts, OG_IMAGE_SIZE } from '@/lib/og-helper';

export const runtime = 'nodejs';

export default async function Image({ params: { locale } }: { params: { locale: string } }) {
  const t = await getTranslations({ locale, namespace: 'Blog.meta' });
  const fonts = await getOgFonts();

  return new ImageResponse(
    (
      <OGImageTemplate
        title={t('title')}
        description={t('description')}
        label="Blog"
      />
    ),
    {
      ...OG_IMAGE_SIZE,
      fonts,
    }
  );
}
