import { readFileSync } from "node:fs";
import { join } from "node:path";
import { ImageResponse } from "next/og";

export const size = { width: 180, height: 180 };
export const contentType = "image/png";

/** Apple touch icon — official ROPTS mark, contain-fit on white (iOS renders touch icons on an opaque tile). */
export default function AppleIcon() {
  const logo = readFileSync(join(process.cwd(), "public/brand/logo.png")).toString("base64");

  return new ImageResponse(
    (
      <div
        style={{
          width: "100%",
          height: "100%",
          display: "flex",
          alignItems: "center",
          justifyContent: "center",
          background: "#FFFFFF",
        }}
      >
        {/* eslint-disable-next-line @next/next/no-img-element */}
        <img src={`data:image/png;base64,${logo}`} width={132} height={88} alt="" />
      </div>
    ),
    { ...size }
  );
}
