import { NextResponse } from "next/server"
import { dumpCsv } from "@/services/rfm-engine"

export async function GET() {
  const csv = dumpCsv()
  return new NextResponse(csv, {
    status: 200,
    headers: {
      "Content-Type": "text/csv; charset=utf-8",
      "Content-Disposition": `attachment; filename="rfm_export_${Date.now()}.csv"`,
    },
  })
}
