import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';

/**
 * One sidebar per top-level navbar tab (see `navbar.items` in
 * docusaurus.config.ts), instead of a single combined "Documentation" sidebar
 * listing every section at once.
 *
 * The client-app guides (browser extensions, mobile apps) live under
 * `installation/` so they nest as collapsible categories in this sidebar —
 * they're primarily about building/running locally, which is mainly relevant to
 * self-hosters.
 *
 * Ordering and labels within a section come from `_category_.json` files and the
 * `sidebar_position` frontmatter on each page. The single-page sections
 * (Architecture, Help & Support) live at the docs root and are linked directly
 * from the navbar, so they don't need their own sidebar.
 */
const sidebars: SidebarsConfig = {
  installSidebar: [
    {
      type: 'category',
      label: 'Self-host Install',
      link: {type: 'doc', id: 'installation/index'},
      collapsed: false,
      items: [
        {
          type: 'category',
          label: 'Install Script',
          link: {type: 'doc', id: 'installation/script/index'},
          items: [{type: 'autogenerated', dirName: 'installation/script'}],
        },
        {
          type: 'category',
          label: 'Docker Compose',
          link: {type: 'doc', id: 'installation/docker-compose/index'},
          items: [{type: 'autogenerated', dirName: 'installation/docker-compose'}],
        },
      ],
    },
    {
      type: 'category',
      label: 'Docs',
      items: ['installation/docs/private-vs-public-email'],
    },
    {
      type: 'category',
      label: 'Browser Extensions',
      link: {type: 'doc', id: 'installation/browser-extensions/index'},
      items: [{type: 'autogenerated', dirName: 'installation/browser-extensions'}],
    },
    {
      type: 'category',
      label: 'Mobile Apps',
      link: {type: 'doc', id: 'installation/mobile-apps/index'},
      items: [{type: 'autogenerated', dirName: 'installation/mobile-apps'}],
    },
  ],
  // Mirror the install sidebar: a clickable "Contributing to AliasVault" header
  // with the contribution guides beneath it, and Development as its own group.
  contributingSidebar: [
    {
      type: 'category',
      label: 'Contributing to AliasVault',
      link: {type: 'doc', id: 'contributing/index'},
      collapsed: false,
      items: ['contributing/ui-translations', 'contributing/identity-generator', 'contributing/passphrase-dictionaries'],
    },
    {
      type: 'category',
      label: 'Development',
      link: {type: 'doc', id: 'contributing/development/index'},
      items: [{type: 'autogenerated', dirName: 'contributing/development'}],
    },
  ],
};

export default sidebars;
