import { fetchPickOrders } from "@/app/api/pickOrder";
import GeneralLoading from "../General/GeneralLoading";
import PickOrderSearch from "./FinishedGoodSearch";

interface SubComponents {
  Loading: typeof GeneralLoading;
}

const FinishedGoodSearchWrapper: React.FC & SubComponents = async () => {
  const [pickOrders] = await Promise.all([
    fetchPickOrders({
      code: undefined,
      targetDateFrom: undefined,
      targetDateTo: undefined,
      type: undefined,
      status: undefined,
      itemName: undefined,
    }),
  ]);

  return <PickOrderSearch pickOrders={pickOrders} />;
};

FinishedGoodSearchWrapper.Loading = GeneralLoading;

export default FinishedGoodSearchWrapper;
