import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";
import { buildLogoutCookie } from "@/lib/auth/cookie";

export async function POST(req: NextRequest) {
  const secure = (req.nextUrl.protocol === "https:") || (req.headers.get("x-forwarded-proto") === "https");
  const res = NextResponse.json({ ok: true });
  res.headers.append("Set-Cookie", buildLogoutCookie({ secure }));
  return res;
}
