import { redirect } from "next/navigation";
import { getAdminUser } from "@/lib/admin-permissions";
import { getActiveBrandId } from "@/lib/brand-scope";
import WholesaleClient from "./WholesaleClient";

export default async function WholesalePage() {
  const adminUser = await getAdminUser();
  if (!adminUser) redirect("/login");

  const activeBrandId = await getActiveBrandId(adminUser);
  return <WholesaleClient brandId={activeBrandId ?? ""} />;
}
