import * as React from "react";
import { createRoot } from 'react-dom/client';
import { BrowserRouter, Routes, Route } from "react-router-dom";
import Authorization from "./Components/Authorization";
import Sections from "./Components/Sections";
import LoggedIn from "./Components/LoggedIn";
import Error404 from "./Components/Error404";


const container = document.getElementById('root');
const root = createRoot(container!);
root.render(
    <React.StrictMode>
        <BrowserRouter>
            <Routes>
                <Route path="/" element={ <Authorization /> } />
                <Route path="/dispatch" element={ <Sections /> } />

                <Route path="/users"     element={ <LoggedIn section={1} /> } />
                <Route path="/entities"  element={ <LoggedIn section={2} /> } />
                <Route path="/tariffs"   element={ <LoggedIn section={3} /> } />
                <Route path="/discounts" element={ <LoggedIn section={4} /> } />
                <Route path="/promocode" element={ <LoggedIn section={5} /> } />


                <Route path="/support"   element={ <LoggedIn section={8} /> } />

                <Route path="/modalAdmin"    element={ <LoggedIn section={-1} /> } />
                <Route path="/modalUser"     element={ <LoggedIn section={-1} /> } />
                <Route path="/modalEntities" element={ <LoggedIn section={-1} /> } />
                <Route
                    path="*"
                    element={ <Error404 /> }
                />
            </Routes>
      </BrowserRouter>
    </React.StrictMode>
);