import { ContentProps } from "@/validations/mutual/dashboard/props";
import ContentToRenderNoPage from "@/pages/mutual/noContent/page";
import pageIndexMulti from "@/pages/multi/index";

const PageToBeChildrendMulti: React.FC<ContentProps> = ({
    activePageUrl,
    userData,
    userLoading,
    userError,
    onlineData,
    onlineLoading,
    onlineError,
    searchParams,
    refreshOnline,
    updateOnline,
    refreshUser,
    updateUser,
}) => {
    const pageComponents = pageIndexMulti[activePageUrl];
    if (!pageComponents) { return <ContentToRenderNoPage lang={onlineData.lang} /> }
    const ComponentKey = Object.keys(pageComponents)[0];
    const PageComponent = pageComponents[ComponentKey];
    if (!PageComponent) { return <ContentToRenderNoPage lang={onlineData.lang} /> }
    return <PageComponent
        activePageUrl={activePageUrl} searchParams={searchParams}
        userData={userData} userLoading={userLoading} userError={userError} refreshUser={refreshUser} updateUser={updateUser}
        onlineData={onlineData} onlineLoading={onlineLoading} onlineError={onlineError} refreshOnline={refreshOnline} updateOnline={updateOnline}
    />;
}

export default PageToBeChildrendMulti
