import { fetchQcCategoryCombo } from "@/app/api/settings/qcCategory";
import { SearchParams } from "@/app/utils/fetchUtil";
import { TypeEnum } from "@/app/utils/typeEnum";
import CreateProductMaterial from "@/components/CreateItem";
import { I18nProvider, getServerI18n } from "@/i18n";
import { Typography } from "@mui/material";
import isString from "lodash/isString";
import { notFound } from "next/navigation";

type Props = {} & SearchParams;

const productSetting: React.FC<Props> = async ({ searchParams }) => {
  const type = "items";
  const { t } = await getServerI18n(type);
  const id = isString(searchParams["id"])
    ? parseInt(searchParams["id"])
    : undefined;
  if (!id) {
    notFound();
  }

  fetchQcCategoryCombo()

  return (
    <>
      {/* <Typography variant="h4">{t("Create Material")}</Typography> */}
      <I18nProvider namespaces={[type, "navigation", "common"]}>
        <CreateProductMaterial id={id} />
      </I18nProvider>
    </>
  );
};
export default productSetting;
