import DefaultTheme from 'vitepress/theme'
import { theme, useOpenapi } from 'vitepress-openapi/client'
import 'vitepress-openapi/dist/style.css'
// @ts-ignore
import './custom.css'
import { Theme } from 'vitepress'

import spec from './openapi.json' with { type: 'json' }

export default {
  extends: DefaultTheme,
  async enhanceApp({ app }) {
    useOpenapi({
      spec,
      config: {
        codeSamples: {
          defaultLang: 'python',
        },
        server: {
          allowCustomServer: true,
        },
      }
    })
    theme.enhanceApp({ app })
  }
} satisfies Theme
