import React from "react";
import QrCodeHandleEquipmentSearch from "./qrCodeHandleEquipmentSearch";
import EquipmentSearchLoading from "../EquipmentSearch/EquipmentSearchLoading";
import { fetchAllEquipmentDetails } from "@/app/api/settings/equipmentDetail";
import { fetchPrinterCombo } from "@/app/api/settings/printer";

interface SubComponents {
  Loading: typeof EquipmentSearchLoading;
}

const QrCodeHandleEquipmentSearchWrapper: React.FC & SubComponents = async () => {
  const [equipmentDetails, printerCombo] = await Promise.all([
    fetchAllEquipmentDetails(),
    fetchPrinterCombo(),
  ]);
  return <QrCodeHandleEquipmentSearch equipmentDetails={equipmentDetails} printerCombo={printerCombo} />;
};

QrCodeHandleEquipmentSearchWrapper.Loading = EquipmentSearchLoading;

export default QrCodeHandleEquipmentSearchWrapper;