import { authOptions } from "@/config/authConfig"
import { getServerSession, Session } from "next-auth"
import DashboardPage from "./DashboardPage"
import { Typography } from "@mui/material"
import { I18nProvider, getServerI18n } from "@/i18n";
import DashboardLoading from "./DashboardLoading";

// export type SessionWithAbilities = {
//     abilities: string[]
// } & Session | null

interface SubComponents {
    Loading: typeof DashboardLoading;
  }

type Props = {
    searchParams: { [key: string]: string | string[] | undefined };
  }
  
const DashboardWrapper: React.FC<Props> & SubComponents = async ({
    searchParams
}) => {

  const { t } = await getServerI18n("dashboard");
//   const session: SessionWithAbilities = await getServerSession(authOptions)

    return (    
        <>
        <Typography variant="h4">{t("Dashboard")}</Typography>
            <DashboardPage
                // abilities={session ? session?.abilities : []}
            />
        </>
    )
}
DashboardWrapper.Loading = DashboardLoading;

export default DashboardWrapper