import { NextRequest, NextResponse } from "next/server";
import { buildOidcAuthUrl, isOidcEnabled } from "@/lib/auth";

export const runtime = "nodejs";

export async function GET(req: NextRequest) {
  if (!isOidcEnabled()) {
    return NextResponse.json({ error: "OIDC 未启用" }, { status: 400 });
  }

  const authUrl = buildOidcAuthUrl();
  return NextResponse.redirect(authUrl);
}
