import { defineConfig } from 'vitepress'
import { useSidebar } from 'vitepress-openapi'
import spec from './theme/openapi.json' with { type: 'json' }


const sidebar = useSidebar({
  spec,
  linkPrefix: '/dev/api-docs/'
})

// https://vitepress.dev/reference/site-config
export default defineConfig({
  title: "NyaHome",
  description: "自托管 AI 创作聊天室平台",
  themeConfig: {
    // https://vitepress.dev/reference/default-theme-config
    nav: [
      { text: '主页', link: '/' },
      { text: '使用', link: '/use/start' },
      { text: '开发', link: '/dev/start' },
    ],

    sidebar: {
      'use': [{
        text: '使用',
        items: [
          { text: '开始', link: '/use/start' },
          { text: '默认行为', link: '/use/default_action' },
          { text: '用户系统', link: '/use/user_system' },
        ]
      },
      ],

      'dev': [
        {
          text: '开发',
          items: [
            { text: '开始', link: '/dev/start' },
            { text: '后端响应', link: '/dev/backend_response' },
            { text: '邮件模板', link: '/dev/email_templates' },
          ]
        },
        {
          text: 'API 文档',
          items: [
            { text: 'API', link: '/dev/api-docs/api' },
            ...sidebar.generateSidebarGroups({}),
          ]
        },]
    },

    socialLinks: [
      { icon: 'github', link: 'https://github.com/vuejs/vitepress' }
    ]
  },

  sitemap: {
    hostname: 'https://docs.nyahome.cn'
  }
})
