import "@/common/styles/fonts.sass";
import "@/common/styles/main.sass";
import {createBrowserRouter, RouterProvider} from "react-router-dom";
import Auth from "@/states/Auth";
import Manage from "@/states/Manage";
import Code from "@/states/Code";
import {UserProvider} from "@/states/Manage/contexts/UserProvider";
import {GuildProvider} from "@/states/Manage/contexts/GuildProvider";
import Chooser from "@/states/Manage/pages/Chooser";
import AchievementList from "@/states/Manage/pages/pages.jsx";

export const AUTH_URL = "https://discord.com/api/oauth2/authorize?client_id=1017165319892107274&redirect_uri=http%3A%2F%2Flocalhost%3A5173%2Fcode&response_type=code&scope=identify%20guilds";

export default () => {
    const router = createBrowserRouter([
        {
            path: "/code",
            element: <Code />
        },
        {
            path: "/auth",
            element: <Auth />
        },
        {
            path: "/",
            element: <UserProvider><GuildProvider><Manage /></GuildProvider></UserProvider>,
            children: [
                {
                    path: "/",
                    element: <Chooser />
                },
                ...AchievementList
            ]
        }
    ]);

    return <RouterProvider router={router}/>;
}