import CompanyHoliday from "@/components/CompanyHoliday";
import { Metadata } from "next";
import { getServerI18n } 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 { fetchCompanys, preloadCompanys } from "@/app/api/companys";

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

const Company: React.FC = async () => {
  const { t } = await getServerI18n("holiday");
  
  // Preload necessary dependencies

  return (
    <>
      <Stack
        direction="row"
        justifyContent="space-between"
        flexWrap="wrap"
        rowGap={2}
      >
        <Typography variant="h4" marginInlineEnd={2}>
          {t("Company Holiday")}
        </Typography>
        {/* <Button
          variant="contained"
          startIcon={<Add />}
          LinkComponent={Link}
          href="/settings/holiday/create"
        >
          {t("Create Holiday")}
        </Button> */}
      </Stack>
      <Suspense fallback={<CompanyHoliday.Loading />}>
        <CompanyHoliday/>
      </Suspense>
    </>
  )
};

export default Company;
