import React from "react";
import GeneralLoading from "../General/GeneralLoading";
import { fetchInventories } from "@/app/api/inventory";
import InventorySearch from "./InventorySearch";
import { fetchPrinterCombo } from "@/app/api/settings/printer";

interface SubComponents {
  Loading: typeof GeneralLoading;
}

const InventorySearchWrapper: React.FC & SubComponents = async () => {
  const [inventories, printerCombo] = await Promise.all([
    fetchInventories(),
    fetchPrinterCombo(),
  ]);

  return <InventorySearch inventories={inventories} printerCombo={printerCombo ?? []} />;
};

InventorySearchWrapper.Loading = GeneralLoading;

export default InventorySearchWrapper;
