import React from "react";
import EditTeam from "./EditTeam";
import EditTeamLoading from "./EditTeamLoading";
// import { fetchTeam, fetchTeamLeads } from "@/app/api/Team";
import { useSearchParams } from "next/navigation";
import { fetchIndivTeam, fetchTeam, fetchTeamDetail } from "@/app/api/team";
import { fetchStaff, fetchStaffWithoutTeam, fetchTeamLeads } from "@/app/api/staff";

interface SubComponents {
  Loading: typeof EditTeamLoading;
}

interface Props {
  id: number
}

const EditTeamWrapper: React.FC<Props> & SubComponents = async ({ id }) => {
  const [
    staff,
    team,
  ] = await Promise.all([
    fetchStaff(),
    fetchIndivTeam(id),
  ]);

  return <EditTeam staff={staff} teamInfo={team} />;
};

EditTeamWrapper.Loading = EditTeamLoading;

export default EditTeamWrapper;
