import path from "node:path";
import { defineConfig } from "@rspress/core";
import { pluginApiDocgen } from "@rspress/plugin-api-docgen";
import { pluginPreview } from "@rspress/plugin-preview";
import GitCodeIcon from "./assets/gitcode.ts";

export default defineConfig({
  plugins: [
    pluginApiDocgen({
      entries: {
        bubble: path.resolve(__dirname, "../src/bubble.tsx"),
        sender: path.resolve(__dirname, "../src/sender.tsx"),
        button: path.resolve(__dirname, "../src/button.tsx"),
        prompt: path.resolve(__dirname, "../src/prompt.tsx"),
        list: path.resolve(__dirname, "../src/list.tsx"),
        fileupload: path.resolve(__dirname, "../src/file-upload.tsx"),
        markdown: path.resolve(__dirname, "../src/markdown.tsx"),
        suggestion: path.resolve(__dirname, "../src/suggestion.tsx"),
      },
      apiParseTool: "react-docgen-typescript",
    }),
    pluginPreview({
      defaultRenderMode: "pure",
    }),
  ],
  root: path.join(__dirname, "docs"),
  title: "MateChat React",
  icon: "/matechat-icon.svg",
  logo: "/matechat-icon.svg",
  logoText: "MateChat React",
  markdown: {
    link: {
      checkDeadLinks: true,
    },
  },
  lang: "en",
  locales: [
    {
      lang: "en",
      label: "English",
      title: "MateChat React",
      description: "Frontend AI scenario solution based on DevUI Design",
    },
    {
      lang: "zh",
      label: "简体中文",
      title: "MateChat React",
      description: "基于 DevUI 设计的前端 AI 解决方案",
    },
  ],
  themeConfig: {
    socialLinks: [
      {
        icon: {
          svg: GitCodeIcon,
        },
        mode: "link",
        content: "https://gitcode.com/DevCloudFE/matechat-react",
      },
      {
        icon: "github",
        mode: "link",
        content: "https://github.com/DevCloudFE/matechat-react",
      },
    ],
    hideNavbar: "auto",
    footer: {
      message: "MIT Licensed | © 2025 DevCloudFE. All Rights Reserved.",
    },
  },
  globalStyles: path.resolve(__dirname, "./docs/tailwind.css"),
  route: {
    cleanUrls: true,
  },
  mediumZoom: {
    selector: ".rspress-doc",
  },
});