import GeneralLoading from "@/components/General/GeneralLoading";
import PageTitleBar from "@/components/PageTitleBar";
import JoPickOrderList from "@/components/JoWorkbench/JoPickOrderList";
import { fetchPrinterCombo } from "@/app/api/settings/printer";
import { I18nProvider, getServerI18n } from "@/i18n";
import { Metadata } from "next";
import React, { Suspense } from "react";

export const metadata: Metadata = {
  title: "Job Order Pick List",
};

const JoWorkbenchPage = async () => {
  const { t } = await getServerI18n("jo");
  const printerCombo = await fetchPrinterCombo();
  //console.log("[JO Workbench Page] printerCombo count:", printerCombo?.length ?? 0);

  return (
    <>
      <PageTitleBar title={t("Job Order Pickexcution", { defaultValue: "Job Order Pickexcution" })} className="mb-4" />
      <I18nProvider namespaces={["jo","navigation","common","pickOrder","purchaseOrder","dashboard"]}>
        <Suspense fallback={<GeneralLoading />}>
          <JoPickOrderList printerCombo={printerCombo ?? []} />
        </Suspense>
      </I18nProvider>
    </>
  );
};

export default JoWorkbenchPage;