import {themes as prismThemes} from 'prism-react-renderer';
import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';

const config: Config = {
  title: '雑記 by swallow',
  tagline: '技術・思考・作ったもの',
  favicon: 'img/favicon.svg',

  future: {
    v4: true,
  },

  url: 'https://www.techswan.online',
  baseUrl: '/',

  onBrokenLinks: 'warn',
  onBrokenMarkdownLinks: 'warn',

  i18n: {
    defaultLocale: 'ja',
    locales: ['ja'],
  },

  plugins: [
    // Tech（技術記事）用のドキュメント
    [
      '@docusaurus/plugin-content-docs',
      {
        id: 'tech',
        path: 'docs-tech',
        routeBasePath: 'tech',
        sidebarPath: './sidebars-tech.ts',
      },
    ],
  ],

  presets: [
    [
      'classic',
      {
        docs: {
          path: 'docs',
          routeBasePath: '/blog',
          sidebarPath: './sidebars.ts',
        },
        blog: false,
        theme: {
          customCss: './src/css/custom.css',
        },
      } satisfies Preset.Options,
    ],
  ],

  themeConfig: {
    image: 'img/ogp-card.png',
    colorMode: {
      defaultMode: 'dark',
      respectPrefersColorScheme: true,
    },
    navbar: {
      logo: {
        alt: 'swallow logo',
        src: 'img/favicon.svg',
      },
      title: '雑記 by swallow',
      items: [
        {
          to: '/blog',
          label: 'Blog',
          position: 'left',
        },
        {
          to: '/tech',
          label: 'Tech',
          position: 'left',
        },
        {
          to: '/works',
          label: 'Works',
          position: 'left',
        },
      ],
    },
    footer: {
      style: 'dark',
      copyright: `© ${new Date().getFullYear()} swallow`,
    },
    prism: {
      theme: prismThemes.github,
      darkTheme: prismThemes.dracula,
      additionalLanguages: ['bash', 'json', 'yaml', 'python'],
    },
    tableOfContents: {
      minHeadingLevel: 2,
      maxHeadingLevel: 4,
    },
  } satisfies Preset.ThemeConfig,
};

export default config;
