import React from "react";
import SubsidiarySearch from "./SubsidiarySearch";
import SubsidiarySearchLoading from "./SubsidiarySearchLoading";
import { fetchAllSubsidiaries } from "@/app/api/subsidiary";

interface SubComponents {
  Loading: typeof SubsidiarySearchLoading;
}

const SubsidiarySearchWrapper: React.FC & SubComponents = async () => {
  const subsidiaries = await fetchAllSubsidiaries();

  return <SubsidiarySearch subsidiaries={subsidiaries} />;
};

SubsidiarySearchWrapper.Loading = SubsidiarySearchLoading;

export default SubsidiarySearchWrapper;