// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion

const {themes} = require('prism-react-renderer');
const lightCodeTheme = themes.github;
const darkCodeTheme = themes.dracula;

/** @type {import('@docusaurus/types').Config} */
const config = {
  title: 'Veza Platform',
  tagline: 'Plateforme de streaming audio et chat en temps réel',
  favicon: 'img/favicon.ico',

  // Set the production url of your site here
  url: 'https://veza-docs.vercel.app',
  // Set the /<baseUrl>/ pathname under which your site is served
  baseUrl: '/',

  // GitHub pages deployment config
  organizationName: 'okinrev',
  projectName: 'veza-full-stack',

  onBrokenLinks: 'throw',
  onBrokenMarkdownLinks: '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: 'fr',
    locales: ['fr'],
  },

  presets: [
    [
      'classic',
      /** @type {import('@docusaurus/preset-classic').Options} */
      ({
        docs: {
          sidebarPath: require.resolve('./sidebars.js'),
          editUrl: 'https://github.com/okinrev/veza-full-stack/tree/main/veza-docs/',
          showLastUpdateAuthor: true,
          showLastUpdateTime: true,
        },
        blog: {
          showReadingTime: true,
          feedOptions: {
            type: 'all',
            title: 'Veza Platform Blog',
            description: 'Blog de la plateforme Veza - Streaming audio et chat temps réel',
            copyright: `Copyright © ${new Date().getFullYear()} Veza Platform.`,
          },
          editUrl: 'https://github.com/okinrev/veza-full-stack/tree/main/veza-docs/',
        },
        theme: {
          customCss: require.resolve('./src/css/custom.css'),
        },
      }),
    ],
  ],

  themeConfig:
    /** @type {import('@docusaurus/preset-classic').ThemeConfig} */
    ({
      // Replace with your project's social card
      image: 'img/veza-social-card.jpg',
      navbar: {
        title: 'Veza Platform',
        logo: {
          alt: 'Veza Logo',
          src: 'img/veza-logo.svg',
        },
        items: [
          {
            type: 'docSidebar',
            sidebarId: 'tutorialSidebar',
            position: 'left',
            label: 'Documentation',
          },
          {
            to: '/blog',
            label: 'Blog',
            position: 'left',
          },
          {
            type: 'docsVersionDropdown',
            position: 'right',
            dropdownActiveClassDisabled: true,
          },
          {
            href: 'https://github.com/okinrev/veza-full-stack',
            label: 'GitHub',
            position: 'right',
          },
        ],
      },
      footer: {
        style: 'dark',
        links: [
          {
            title: 'Documentation',
            items: [
              {
                label: 'Vue d\'ensemble',
                to: '/docs/overview',
              },
              {
                label: 'Architecture',
                to: '/docs/architecture/system',
              },
              {
                label: 'API Reference',
                to: '/docs/api-reference/openapi',
              },
              {
                label: 'Déploiement',
                to: '/docs/infra/ci-cd',
              },
            ],
          },
          {
            title: 'Services',
            items: [
              {
                label: 'Frontend Web',
                to: '/docs/sectors/web',
              },
              {
                label: 'Backend API',
                to: '/docs/backend/go-api',
              },
              {
                label: 'Chat Server',
                to: '/docs/backend/rust-chat',
              },
              {
                label: 'Stream Server',
                to: '/docs/backend/rust-stream',
              },
            ],
          },
          {
            title: 'Infrastructure',
            items: [
              {
                label: 'Conteneurs',
                to: '/docs/infra/containers',
              },
              {
                label: 'Réseau',
                to: '/docs/infra/networking',
              },
              {
                label: 'Sécurité',
                to: '/docs/infra/security',
              },
              {
                label: 'Observabilité',
                to: '/docs/infra/observability',
              },
            ],
          },
          {
            title: 'Ressources',
            items: [
              {
                label: 'GitHub',
                href: 'https://github.com/okinrev/veza-full-stack',
              },
              {
                label: 'Issues',
                href: 'https://github.com/okinrev/veza-full-stack/issues',
              },
              {
                label: 'Discussions',
                href: 'https://github.com/okinrev/veza-full-stack/discussions',
              },
              {
                label: 'Roadmap',
                to: '/docs/product/roadmap',
              },
            ],
          },
        ],
        copyright: `Copyright © ${new Date().getFullYear()} Veza Platform. Built with Docusaurus.`,
      },
      prism: {
        theme: lightCodeTheme,
        darkTheme: darkCodeTheme,
        additionalLanguages: ['bash', 'json', 'yaml', 'toml', 'rust', 'go', 'typescript', 'javascript'],
      },
      // Configuration pour un design moderne
      colorMode: {
        defaultMode: 'light',
        disableSwitch: false,
        respectPrefersColorScheme: true,
      },
      // Métadonnées pour SEO
      metadata: [
        { name: 'keywords', content: 'veza, streaming, audio, chat, real-time, documentation, microservices, rust, go, react' },
        { name: 'description', content: 'Documentation complète de la plateforme Veza - Streaming audio et chat en temps réel avec architecture microservices' },
      ],
      // Configuration Mermaid
      mermaid: {
        theme: { light: 'default', dark: 'dark' },
        options: {
          maxTextSize: 50000,
          securityLevel: 'loose',
        },
      },
      // Configuration de recherche
      algolia: {
        appId: 'YOUR_APP_ID',
        apiKey: 'YOUR_SEARCH_API_KEY',
        indexName: 'veza-docs',
        contextualSearch: true,
        searchParameters: {},
        searchPagePath: 'search',
      },
    }),

  // Configuration Mermaid
  markdown: {
    mermaid: true,
  },

  // Configuration des plugins
  plugins: [],

  // Configuration des thèmes
  themes: ['@docusaurus/theme-mermaid'],
  markdown: {
    mermaid: true,
  },

  // Configuration des scripts
  scripts: [
    {
      src: 'https://plausible.io/js/script.js',
      defer: true,
      'data-domain': 'veza-docs.vercel.app',
    },
  ],

  // Configuration des styles
  stylesheets: [
    {
      href: 'https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap',
      type: 'text/css',
    },
  ],

  // Configuration des redirections
  trailingSlash: false,
};

module.exports = config;