/**
 * @file Sidebar configuration for documentation entries.
 *
 * @import { SidebarItemConfig } from "@docusaurus/plugin-content-docs/src/sidebars/types.js"
 */

import "./ensure-reference-sidebar.mjs";

// No file extensions for Docusaurus's automatic resolution.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore - Allows for project-wide type checking when partially building docs.
import apiReference from "./reference/sidebar";

import { prepareReleaseEnvironment } from "@goauthentik/docusaurus-theme/releases/node";

const releaseEnvironment = prepareReleaseEnvironment();

/**
 * @type {SidebarItemConfig}
 */
const sidebar = {
    reference: [
        {
            type: "link",
            label: "← Back to Developer Docs",
            href: new URL("/developer-docs", releaseEnvironment.preReleaseOrigin).href,
            className: "navbar-sidebar__upwards",
        },
        {
            type: "doc",
            label: "API Overview",
            className: "api-overview",
            id: "index",
        },

        {
            type: "doc",
            label: "Authentication",
            id: "authentication",
        },

        {
            type: "doc",
            label: "Flow executor (backend)",
            id: "flow-executor",
        },

        {
            type: "doc",
            label: "Websockets",
            id: "websocket",
        },

        {
            type: "doc",
            label: "API Clients",
            id: "clients",
        },

        {
            type: "category",
            label: "API Reference",
            className: "api-reference",
            collapsed: false,
            collapsible: false,
            link: {
                type: "doc",
                id: apiReference[0].id,
            },

            items: apiReference.slice(1),
        },
    ],
};

export default sidebar;
