import { fetchPickOrders } from "@/app/api/pickOrder";
import { fetchPrinterCombo } from "@/app/api/settings/printer";
import GeneralLoading from "../General/GeneralLoading";
import JodetailSearch from "./JodetailSearch";

interface SubComponents {
  Loading: typeof GeneralLoading;
}

const JodetailSearchWrapper: React.FC & SubComponents = async () => {
  const [pickOrders, printerCombo] = await Promise.all([
    fetchPickOrders({
      code: undefined,
      targetDateFrom: undefined,
      targetDateTo: undefined,
      type: undefined,
      status: undefined,
      itemName: undefined,
      pageNum: 0,
      pageSize: 50,
    }),
    fetchPrinterCombo(),
  ]);
  console.log("%c printerCombo:", "color:green", printerCombo);

  return <JodetailSearch pickOrders={pickOrders} printerCombo={printerCombo} />;
};

JodetailSearchWrapper.Loading = GeneralLoading;

export default JodetailSearchWrapper;