import {createBrowserRouter, RouterProvider} from "react-router-dom";
import HomePage from "./pages/home/index.page.tsx";
import NotFound from "./pages/not-found/index.page.tsx";
import Layout from "@/components/layout";
import QRCodeGenerator from "./pages/util/qr/index.page.tsx";
import EventsRouter from "./pages/events/EventsRouter.tsx";
import LegalPage from "@/pages/LegalPage.tsx";

const router = createBrowserRouter([
    {
        path: "/",
        element: <Layout/>,
        children: [
            {
                index: true,
                element: <HomePage/>
            },
            {
                path: "legal/:page",
                element: <LegalPage/>
            },
            {
                path: "events/*",
                element: <EventsRouter/>,
            },
            {
                path: "util",
                children: [
                    {
                        path: "qr",
                        element: <QRCodeGenerator/>
                    }
                ]
            },
            {
                path: "*",
                element: <NotFound/>
            }
        ]
    }
])


function Router() {

    return (
        <RouterProvider router={router}/>
    )
}

export default Router
