import { fetchCompanyDetails } from "@/app/api/companys";
import CreateCompany from "./CreateCompany";

type CreateCompanyProps = {isEdit: false}
interface EditCompanyProps {
    isEdit: true;
    companyId?: string;
}

type Props = CreateCompanyProps | EditCompanyProps;

const CreateCompanyWrapper: React.FC<Props> = async (props) => {

    // console.log(props)

    const companyDetails = props.isEdit
  ? await fetchCompanyDetails(props.companyId!)
  : undefined;

    return (
        <CreateCompany isEdit company={companyDetails}
        />
    )
}

export default CreateCompanyWrapper;