import React from "react";
import GeneralLoading from "../General/GeneralLoading";
import JoSearch from "./JoSearch";
import { SearchJoResultRequest } from "@/app/api/jo/actions";
import { fetchBomCombo } from "@/app/api/bom";

interface SubComponents {
    Loading: typeof GeneralLoading;
}

const JoSearchWrapper: React.FC & SubComponents = async () => {
    const defaultInputs: SearchJoResultRequest = {
        code: "",
        itemName: "",
    }

    const [
        bomCombo
    ] = await Promise.all([
        fetchBomCombo()
    ])
    
    return <JoSearch defaultInputs={defaultInputs} bomCombo={bomCombo}/>
}

JoSearchWrapper.Loading = GeneralLoading;

export default JoSearchWrapper;