import { Metadata } from "next";
import { I18nProvider } from "@/i18n";
import UserWorkspacePage from "@/components/UserWorkspacePage";
import {
  fetchLeaveTypes,
  fetchLeaves,
  fetchTeamMemberLeaves,
  fetchTeamMemberTimesheets,
  fetchTimesheets,
} from "@/app/api/timesheets";
import {
  fetchAssignedProjects,
  fetchProjectWithTasks,
} from "@/app/api/projects";
import { fetchHolidays } from "@/app/api/holidays";
import { fetchAllTasks } from "@/app/api/tasks";

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

const Home: React.FC = async () => {
  fetchTimesheets();
  fetchAssignedProjects();
  fetchLeaves();
  fetchLeaveTypes();
  fetchProjectWithTasks();
  fetchHolidays();
  fetchTeamMemberTimesheets();
  fetchTeamMemberLeaves();
  fetchAllTasks();

  return (
    <I18nProvider namespaces={["home", "common"]}>
      <UserWorkspacePage />
    </I18nProvider>
  );
};

export default Home;
