import { Metadata } from "next";
import { I18nProvider } from "@/i18n";
import { Suspense } from "react";
import { getServerI18n } from "@/i18n";
import DashboardPage from "@/components/DashboardPage";
import { SearchParams } from "@/app/utils/fetchUtil";
import { fetchEscalationLogsByUser } from "@/app/api/escalation";

export const metadata: Metadata = {
  title: "Dashboard",
};

type Props = {} & SearchParams;

const Dashboard: React.FC<Props> = async ({ searchParams }) => {
  const { t } = await getServerI18n("dashboard");

  fetchEscalationLogsByUser()

  return (
    <I18nProvider namespaces={["dashboard","navigation","common","purchaseOrder"]}>
      <Suspense fallback={<DashboardPage.Loading />}>
        <DashboardPage searchParams={searchParams} />
      </Suspense>
    </I18nProvider>
  );
};

export default Dashboard;
