import { NextResponse } from "next/server";

export const dynamic = "force-dynamic";

/**
 * GET /api/push/vapid-public-key
 * Returns the VAPID public key so the client can subscribe via PushManager.
 * This is a public endpoint — the public key is not a secret.
 */
export async function GET() {
  const key = process.env.VAPID_PUBLIC_KEY;
  if (!key) {
    return NextResponse.json(
      { error: "VAPID keys not configured." },
      { status: 503 }
    );
  }
  return NextResponse.json({ publicKey: key });
}
