import { NextResponse } from "next/server";
import { buildRoomStatus } from "@/lib/buildRoomStatus";
import { apiHandler, ApiError } from "@/lib/api";

export const GET = apiHandler(async (_req, { params }) => {
  const { id } = await params;

  const status = await buildRoomStatus(id);
  if (!status) throw new ApiError("房间不存在或已过期", 404);

  return NextResponse.json(status);
});
