import React, { useEffect } from "react";
import { useOrganizationModal } from "./hooks/useOrganization";
import OrganizationModal from "./components/Organization/OrganizationModal";
import { useAuthModal, useModal } from "./hooks/useAuth";
import SwitchTenant from "./pages/authentication/SwitchTenant";
import ChangePasswordPage from "./pages/authentication/ChangePassword";
import NewCollection from "./components/collections/NewCollection";

const ModalProvider = () => {
  const { isOpen, onClose } = useOrganizationModal();
  const { isOpen: isAuthOpen } = useAuthModal();
  const {isOpen:isChangePass}  = useModal("ChangePassword")
  const {isOpen:isCollectionNew}  = useModal("newCollection");

  return (
    <>
      {isOpen && <OrganizationModal />}
      {isAuthOpen && <SwitchTenant />}
      {isChangePass && <ChangePasswordPage /> }
      {isCollectionNew && <NewCollection/>}
    </>
  );
};

export default ModalProvider;