import { Metadata } from "next";
import { getServerI18n, I18nProvider } from "@/i18n";
import PageTitleBar from "@/components/PageTitleBar";
import BomWeightingScoreTable from "@/components/BomWeightingScoreTable";
import { fetchBomWeightingScores } from "@/app/api/settings/bomWeighting";

export const metadata: Metadata = {
  title: "BOM Weighting Score",
};

const BomWeightingScorePage: React.FC = async () => {
  const { t } = await getServerI18n("common");
  const bomWeightingScores = await fetchBomWeightingScores();

  return (
    <>
      <PageTitleBar title={t("BOM Weighting Score List")} className="mb-4" />
      <I18nProvider namespaces={["common"]}>
        <BomWeightingScoreTable bomWeightingScores={bomWeightingScores} />
      </I18nProvider>
    </>
  );
};

export default BomWeightingScorePage;
