import { CssBaseline } from '@mui/material'
import { BrowserRouter } from 'react-router-dom'
import ConfirmContextProvider from '../components/PopupConfirm/ConfirmContextProvider'
import MuiThemeProvider from '../theme/MuiThemeProvider'
import QueryClientProvider from './QueryClientProvider'

import { ReactNode } from 'react'
import { ToastContainer } from '../components'
import DialogProvider from '../components/DrawerWrapper/DrawerWrapper'

// export const campxTenantKey = Cookies.get('campx_tenant')
// export const urlTenantKey = window.location.pathname.split('/')[1]

export default function PublicProviders({ children }: { children: ReactNode }) {
  return (
    <BrowserRouter>
      <QueryClientProvider>
        <MuiThemeProvider>
          <ConfirmContextProvider>
            <DialogProvider>
              {children}
              <CssBaseline />
              <ToastContainer />
            </DialogProvider>
          </ConfirmContextProvider>
        </MuiThemeProvider>
      </QueryClientProvider>
    </BrowserRouter>
  )
}
