import { ImageResponse } from "next/og"
import type { NextRequest } from "next/server"

export const runtime = "edge"

export async function GET(request: NextRequest) {
  try {
    return new ImageResponse(
      <div
        style={{
          height: "100%",
          width: "100%",
          display: "flex",
          flexDirection: "column",
          alignItems: "center",
          justifyContent: "center",
          backgroundColor: "#1e1e2e",
          backgroundImage:
            "radial-gradient(circle at 25px 25px, #333 2%, transparent 0%), radial-gradient(circle at 75px 75px, #333 2%, transparent 0%)",
          backgroundSize: "100px 100px",
        }}
      >
        <div
          style={{
            display: "flex",
            flexDirection: "column",
            alignItems: "center",
            justifyContent: "center",
            padding: "20px 50px",
            margin: "0 50px",
            fontSize: 60,
            fontWeight: 700,
            fontFamily: "system-ui, sans-serif",
            color: "white",
            textAlign: "center",
            background: "linear-gradient(to right, #9333ea, #a855f7)",
            backgroundClip: "text",
            WebkitBackgroundClip: "text",
            color: "transparent",
          }}
        >
          QuantumVerify
        </div>
        <div
          style={{
            fontSize: 40,
            fontFamily: "system-ui, sans-serif",
            letterSpacing: -1,
            color: "white",
            marginTop: 20,
            padding: "0 120px",
            textAlign: "center",
          }}
        >
          Real-time, quantum-secure verification before the money moves
        </div>
        <div
          style={{
            fontSize: 28,
            fontFamily: "system-ui, sans-serif",
            color: "#a1a1aa",
            marginTop: 20,
            padding: "0 120px",
            textAlign: "center",
          }}
        >
          Cross-border payments confirmed in ≤ 100 ms
        </div>
      </div>,
      {
        width: 1200,
        height: 630,
      },
    )
  } catch (e) {
    console.error(e)
    return new Response("Failed to generate OG image", { status: 500 })
  }
}
