// @ts-check
// `@type` JSDoc annotations allow editor autocompletion and type checking
// (when paired with `@ts-check`).
// There are various equivalent ways to declare your Docusaurus config.
// See: https://docusaurus.io/docs/api/docusaurus-config

import { themes as prismThemes } from "prism-react-renderer";

// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)

/** @type {import('@docusaurus/types').Config} */
const config = {
  title: "Decoda",
  tagline: "Programação Popular para Todos",
  favicon: "img/puzzle.svg",

  // Future flags, see https://docusaurus.io/docs/api/docusaurus-config#future
  future: {
    v4: true, // Improve compatibility with the upcoming Docusaurus v4
  },

  // Set the production url of your site here
  url: "https://decoda.mtst.tec.br",
  // Set the /<baseUrl>/ pathname under which your site is served
  // For GitHub pages deployment, it is often '/<projectName>/'
  baseUrl: "/docs/",

  // GitHub pages deployment config.
  // If you aren't using GitHub pages, you don't need these.
  organizationName: "decoda", // Usually your GitHub org/user name.
  projectName: "decoda", // Usually your repo name.

  onBrokenLinks: "throw",

  // Even if you don't use internationalization, you can use this field to set
  // useful metadata like html lang. For example, if your site is Chinese, you
  // may want to replace "en" with "zh-Hans".
  i18n: {
    defaultLocale: "pt-BR",
    locales: ["pt-BR"],
  },

  markdown: {
    mermaid: true,
  },
  themes: ["@docusaurus/theme-mermaid"],

  plugins: [
    [
      require.resolve("@easyops-cn/docusaurus-search-local"),
      {
        hashed: true,
        language: ["pt", "en"],
        indexDocs: true,
        indexPages: false,
        docsRouteBasePath: ["/docs", "/edu"],
        searchResultLimits: 8,
        searchResultContextMaxLength: 50,
        explicitSearchResultPath: true,
        searchBarPosition: "right",
        searchBarShortcut: true,
        searchBarShortcutHint: true,
        removeDefaultStopWordFilter: false,
        highlightSearchTermsOnTargetPage: true,
      },
    ],
    [
      require.resolve("@docusaurus/plugin-content-docs"),
      {
        id: "edu",
        path: "edu",
        routeBasePath: "edu",
        sidebarPath: "./sidebars.js",
        showLastUpdateTime: false,
        showLastUpdateAuthor: false,
      },
    ],
  ],

  presets: [
    [
      "classic",
      /** @type {import('@docusaurus/preset-classic').Options} */
      ({
        docs: {
          path: "docs",
          routeBasePath: "docs",
          sidebarPath: "./sidebars.js",
          // Enable local search indexing
          showLastUpdateTime: false,
          showLastUpdateAuthor: false,
        },
        theme: {
          // ADICIONE ESTA LINHA PARA O CSS GLOBAL:
          customCss: require.resolve('./src/css/custom.css'),
        },
      }),
    ],
  ],

  stylesheets: [
    {
      href: "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css",
      type: "text/css",
    },
  ],

  themeConfig:
    /** @type {import('@docusaurus/preset-classic').ThemeConfig} */
    ({
      // Replace with your project's social card
      image: "img/docusaurus-social-card.jpg",
      colorMode: {
        // always use light mode and hide the toggle so dark is unreachable
        defaultMode: "light",
        disableSwitch: true,
        respectPrefersColorScheme: false,
      },
      navbar: {
        logo: {
          alt: "Decoda",
          src: "img/logo_decoda.png",
        },
        items: [
          {
            to: "/edu/intro",
            position: "right",
            label: "Educadores",
            activeBaseRegex: "/docs/edu/",
          },
          {
            to: "/docs/docs/intro",
            position: "right",
            label: "Desenvolvedores",
            activeBaseRegex: "/docs/docs/",
          },
        ],
        hideOnScroll: false,
      },
      docs: {
        sidebar: {
          hideable: false,
          autoCollapseCategories: true,
        },
      },
      prism: {
        theme: prismThemes.github,
        darkTheme: prismThemes.dracula,
      },
    }),
};

export default config;
