import { defineNuxtModule, createResolver, addComponentsDir, addImportsDir } from '@nuxt/kit'

// Module options TypeScript interface definition
export interface ModuleOptions {}

export default defineNuxtModule<ModuleOptions>({
  meta: {
    name: 'websites',
    configKey: 'websites',
  },
  setup(options, nuxt) {
    const resolver = createResolver(import.meta.url)
    addComponentsDir({
      path: resolver.resolve('./runtime/components'),
      pathPrefix: false,
      prefix: '',
      global: true,
    })
    addImportsDir(resolver.resolve('./runtime/composables'))
    nuxt.options.runtimeConfig.public.websites = options
  }
})
