import { fetchAllTasks, fetchTaskTemplates } from "@/app/api/tasks";
import CreateDepartment from "./CreateDepartment";
import { fetchTeamLeads } from "@/app/api/staff";
import { DepartmentResult, fetchDepartmentDetails } from "@/app/api/departments";

type CreateDepartmentProps = { isEdit: false };
interface EditDepartmentProps {
  isEdit: true;
  departmentId?: string;
}

type Props = CreateDepartmentProps | EditDepartmentProps;

const CreateDepartmentWrapper: React.FC<Props> = async (props) => {
  
  const departmentInfo = props.isEdit
  ? await fetchDepartmentDetails(props.departmentId!)
  : undefined;

  return (
    <CreateDepartment isEdit department={departmentInfo}
    />
  );
};

export default CreateDepartmentWrapper;
