// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  compatibilityDate: '2024-12-25',
  devServer: {
    host: '0.0.0.0',
    port: 4055
  },
  devtools: { enabled: true },
  
  // SSR 비활성화 (SPA 모드)
  ssr: false,
  
  // 디렉토리 커스터마이징
  dir: {
    pages: 'frontend'
  },
  serverDir: 'backend',
  
  // 컴포넌트 경로
  components: [
    { path: '~/frontend/components', pathPrefix: false }
  ],
  
  // composables 경로
  imports: {
    dirs: ['frontend/composables']
  },
  
  app: {
    head: {
      title: 'OSOLIT Monitor - Network Status',
      meta: [
        { charset: 'utf-8' },
        { name: 'viewport', content: 'width=device-width, initial-scale=1' },
        { name: 'description', content: 'Global Network Status Monitoring Dashboard' }
      ],
      link: [
        { rel: 'preconnect', href: 'https://fonts.googleapis.com' },
        { rel: 'preconnect', href: 'https://fonts.gstatic.com', crossorigin: '' },
        { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;600&display=swap' }
      ]
    }
  },

  css: ['~/frontend/assets/css/main.css'],

  // 서버 설정
  nitro: {
    preset: 'node-server',
    experimental: {
      websocket: true
    },
    externals: {
      inline: []
    },
    rollupConfig: {
      external: ['pg']
    },
    plugins: [
      '~/backend/plugins/pubnet-init.ts',
      '~/backend/plugins/privnet-init.ts'
    ]
  },

  // Vite 설정
  vite: {
    optimizeDeps: {
      exclude: ['pg']
    }
  }
})
