import React from 'react'
import PropTypes from 'prop-types';
import ClientRoutes from './JKClientRoutes';
import UserAuth from '../context/UserAuth';
import { BrowserQueryProvider } from '../context/BrowserQuery';
import { JamKazamAppProvider } from '../context/JamKazamAppContext';
import { AppDataProvider } from '../context/AppDataContext';
import { AppRoutesProvider } from '../context/AppRoutesContext';
import { JamClientProvider } from '../context/JamClientContext';
import { JamServerProvider } from '../context/JamServerContext';
import { MixersProvider } from '../context/MixersContext';
import { VuProvider } from '../context/VuContext';
import { GlobalProvider } from '../context/GlobalContext';

const JKClientLayout = ({ location }) => {

  return (

    <UserAuth path={location.pathname}>
      <AppRoutesProvider>
        <GlobalProvider>
          <AppDataProvider>
            <JamKazamAppProvider>
              <BrowserQueryProvider>
                <JamClientProvider>
                  <JamServerProvider>
                    <VuProvider>
                      <MixersProvider>
                        <ClientRoutes />
                      </MixersProvider>
                    </VuProvider>
                  </JamServerProvider>
                </JamClientProvider>
              </BrowserQueryProvider>
            </JamKazamAppProvider>
          </AppDataProvider>
        </GlobalProvider>
      </AppRoutesProvider>
    </UserAuth>

  )
}
JKClientLayout.propTypes = { location: PropTypes.object.isRequired };

export default JKClientLayout
