import { Metadata } from "next";
import { getServerI18n, I18nProvider } from "@/i18n";
import Add from "@mui/icons-material/Add";
import Button from "@mui/material/Button";
import Stack from "@mui/material/Stack";
import Typography from "@mui/material/Typography";
import Link from "next/link";
import { Suspense } from "react";
import InvoiceSearch from "@/components/InvoiceSearch";

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

const Invoice: React.FC = async () => {
  const { t } = await getServerI18n("Invoice");

  return (
    <>
      <Stack
        direction="row"
        justifyContent="space-between"
        flexWrap="wrap"
        rowGap={2}
      >
        <Typography variant="h4" marginInlineEnd={2}>
          {t("Invoice")}
        </Typography>
        {/* <Button
          variant="contained"
          startIcon={<Add />}
          LinkComponent={Link}
          href="/invoice/new"
        >
          {t("Create Invoice")}
        </Button> */}
      </Stack>
      <Suspense fallback={<InvoiceSearch.Loading />}>
        <I18nProvider namespaces={["Invoice", "common"]}>
          <InvoiceSearch />
        </I18nProvider>
      </Suspense>
    </>
  )
};

export default Invoice;
