/** @type {import('@docusaurus/types').DocusaurusConfig} */
const gitBranch = process.env.GIT_BRANCH || 'main'

const baseUrl = process.env.DOCUSAURUS_BASE_URL || '/'

module.exports = {
  title: 'FIT-Connect',
  url: 'https://docs.fitko.de',
  baseUrl,
  onBrokenLinks: 'throw',
  onBrokenMarkdownLinks: 'throw',
  favicon: 'favicon.png',
  i18n: {
    defaultLocale: 'de',
    locales: ['de'],
  },
  themeConfig: {
    announcementBar: {
      id: 'under-construction',
      content:
        '🚧 Die Dokumentation ist aktuell noch in stetigem Wandel. Kontaktmöglichkeiten für Fragen, Probleme und Feedback haben wir <a href="https://docs.fitko.de/fit-connect/contact">auf der Kontakt-Seite</a> zusammengestellt.',
      backgroundColor: '#FFC819',
      textColor: '#000000',
      isCloseable: true,
    },
    colorMode: {
      disableSwitch: true,
    },
    docs: {
      sidebar: {
        hideable: true,
      },
    },
    prism: {
      additionalLanguages: ['java', 'csharp'],
    },
    navbar: {
      /* title: 'FIT-Connect', */
      logo: {
          alt: 'FIT-Connect-Logo',
          src: '/images/FIT-Connect-logo.svg',
          srcDark: '/images/FIT-Connect-logo.svg',
          /* href: 'https://www.fitko.de/projektmanagement/fit-connect', */
          /* href: 'https://docs.fitko.de/fit-connect/docs/', */
          href: '/',
          target: '_self',
          width: 250,
          height: 30,        
        },
      items: [
        {
          type: 'html',
          value: `<a href="/"><img src="${baseUrl}icons/chevron-left.svg" alt="Zurück" /></a>`,
          position: 'left',
          className: 'fitko-navbar-icon--back',
        },
        {
          type: 'html',
          value: `<a href="/"><img src="${baseUrl}icons/chevron-left.svg" alt="Zurück" /></a>`,
          position: 'left',
          className: 'fitko-navbar-icon--back',
        },
        {to: '/docs/startseite', label: 'Startseite', position: 'left'},         {
          type: 'dropdown',
          label: 'API',
          items: [
            {
              type: 'doc',
              label: 'Submission API',
              docId: 'apis/submission-api'
            },
            {
              type: 'doc',
              label: 'Routing API',
              docId: 'apis/routing-api'
            },
            {
              type: 'doc',
              label: 'Self-Service API',
              docId: 'apis/self-service-api'
            }
          ]
        },
        {
          type: 'dropdown',
          label: 'Schemata',
          items: [
            {
              type: 'doc',
              label: 'Metadatenschema',
              docId: 'metadata/overview',
            },
            {
              type: 'doc',
              label: 'Security Event Token',
              docId: 'set-schema/overview'
            }
          ]
        },
        {to: '/faq', label: 'FAQ'},  
        {
          type: 'dropdown',
          label: 'Kontakt',
          items: [
            {
              type: 'doc',
              label: 'Support / Anregungen',
              docId: 'contact/contact'
            },
            {
              type: 'doc',
              label: 'Newsletter',
              docId: 'contact/newsletter'
            }
          ]
        },
        /*
        {
          type: 'dropdown',
          label: 'Tools',
          items: [
            {
              type: 'doc',
              label: '🚧 JWK Generator',
              docId: 'tools/jwk-gen'
            }
          ]
        },
        */
        {to: '/termine', label: 'Termine'},   
        {
          type: 'dropdown',
          position: 'right',
          label: 'Self-Service-Portal',
          items: [
            {
              label: 'Öffentliche Testumgebung',
              href: 'https://portal.auth-testing.fit-connect.fitko.dev/'
            },
            {
              label: 'Staging-Umgebung',
              href: 'https://portal.auth-refz.fit-connect.fitko.net/'
            },
            {
              label: 'Produktiv-Umgebung',
              href: 'https://portal.auth-prod.fit-connect.fitko.net/'
            },
          ],
        }
      ],
    },
    footer: {
      style: 'light',
      logo: {
        alt: 'FIT-Connect-Logo',
        src: '/images/FIT-Connect-logo.svg',
        href: 'https://www.fitko.de/projektmanagement/fit-connect',
        width: 250,
        height: 30,        
      },
      copyright: `Diese Seite ist Teil des <a href="https://docs.fitko.de/">Föderalen Entwicklungsportals</a>. Verantwortlich für die Inhalte der Seite sind die jeweiligen Autoren. Wenn nicht anders vermerkt, sind die Inhalte dieser Webseite lizenziert unter der <a href="https://creativecommons.org/licenses/by/4.0/deed.de">Creative Commons Namensnennung 4.0 International Public License (CC BY 4.0)</a>. Die technische Infrastruktur wird betrieben durch die FITKO. Es gilt das <a href="https://www.fitko.de/impressum">Impressum der FITKO</a> und die <a href="https://fitko.de/datenschutz">Datenschutzerklärung der FITKO</a> mit der Maßgabe, dass kein Tracking durchgeführt wird und keine Cookies gesetzt werden.`,
    },
  },
  presets: [
    [
      '@docusaurus/preset-classic',
      {
        theme: {
          customCss: require.resolve('./src/css/style.scss'),
        },
        docs: {
          sidebarPath: require.resolve('./sidebar.js'),
          editUrl: ({ version, versionDocsDirPath, docPath }) =>
            `https://git.fitko.de/-/ide/project/fit-connect/docs/edit/${gitBranch}/-/${versionDocsDirPath}/${docPath}`,
          routeBasePath: 'docs',
          breadcrumbs: false,
        },
      },
    ],
  ],
  plugins: [
    [
      require.resolve("@cmfcmf/docusaurus-search-local"),
      {
        indexBlog: false,
      }
    ],
    'docusaurus-plugin-sass',
    'docusaurus-tailwindcss',
    '@docusaurus/plugin-client-redirects',
    require.resolve('./plugins/webpack'),
    [
      'docusaurus-node-polyfills',
      {
        includeAliases: ['process'],
      },
    ],
  ],
  scripts: [ {
      src: `${baseUrl}js/custom.js`,
      async: false,
    },
  ],
}