export const metadata = { title: "Organization Investors" };
import { DashboardPage } from "@/components/layout/dashboard-page";
import { getDashboardRole } from "@/lib/auth/dashboard-role";
import { InvestorList } from "@/features/people/investor-list";
import { getInvestorPageData } from "@/features/people/investor-server";

export default async function DashboardRoute(props: {
  searchParams: Promise<Record<string, string | string[] | undefined>>;
}) {
  const query = await props.searchParams;
  const role = await getDashboardRole(
    Array.isArray(query.role) ? query.role[0] : query.role,
  );
  const data =
    role === "admin"
      ? await getInvestorPageData()
      : { mode: "preview" as const, investors: [], groups: [], groupMembers: {} };
  return (
    <DashboardPage role={role}>
      <InvestorList data={data} />
    </DashboardPage>
  );
}
