import 'antd/dist/antd.min.css';
import { Spin } from 'antd';
import { BrowserRouter } from 'react-router-dom';
import { createRoot } from 'react-dom/client';
import { Suspense } from 'react';
import { StoreProvider } from './stores/StoreProvider';
import { rootStore } from './stores/RootStore';
import reportWebVitals from './reportWebVitals';
import App from './App/App';
import '../src/core/i18n';
import './index.css';
import './styles/styles.scss';

const rootId = document.getElementById('root');
if (rootId === null) throw new Error('Root container missing in index.html');

const root = createRoot(rootId);
root.render(
  <BrowserRouter>
    <Suspense fallback={<Spin size="large" className="spinnerGlobal" />}>
      <StoreProvider value={rootStore}>
        <App />
      </StoreProvider>
    </Suspense>
  </BrowserRouter>,
);

reportWebVitals();
