import CreateDepartment from "@/components/CreateDepartment";
import { I18nProvider, getServerI18n } from "@/i18n";
import Typography from "@mui/material/Typography";
import { Metadata } from "next";

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

interface Props {
  searchParams: { [key: string]: string | undefined };
}

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

  // Preload necessary dependencies
  // Assume projectId is string here
  const departmentId = searchParams["id"];

  return (
    <>
      <Typography variant="h4">{t("Create Department")}</Typography>
      <I18nProvider namespaces={["departments"]}>
        <CreateDepartment isEdit={true} departmentId={departmentId}/>
      </I18nProvider>
    </>
  );
};

export default Department;
