import { ImageResponse } from "next/og";
import { readFile } from "node:fs/promises";
import { join } from "node:path";
import { OgImageContent, ogImageSize } from "@/lib/og-image";

export const alt = "Entscheidomat – Lass den Zufall entscheiden";
export const size = ogImageSize;
export const contentType = "image/png";

export const runtime = "nodejs";

export default async function Image() {
  const image = await readFile(join(process.cwd(), "public/images/og-decision-tools.jpg"));
  const visualSrc = `data:image/jpeg;base64,${image.toString("base64")}`;

  return new ImageResponse(<OgImageContent visualSrc={visualSrc} />, size);
}
