import { definePreset } from '@primeuix/themes'
import Aura from '@primeuix/themes/aura'
import tailwindcss from '@tailwindcss/vite'

export default defineNuxtConfig({
  compatibilityDate: '2025-09-29',
  devtools: { enabled: true, vueDevTools: true },
  ssr: false,
  modules: [
    '@nuxt/fonts',
    '@primevue/nuxt-module',
    '@formkit/auto-animate/nuxt',
  ],
  fonts: {
    provider: 'google',
  },
  primevue: {
    options: {
      theme: {
        preset: definePreset(Aura, {
          semantic: {
            transitionDuration: '150ms',
            primary: {
              50: '{zinc.50}',
              100: '{zinc.100}',
              200: '{zinc.200}',
              300: '{zinc.300}',
              400: '{zinc.400}',
              500: '{zinc.500}',
              600: '{zinc.600}',
              700: '{zinc.700}',
              800: '{zinc.800}',
              900: '{zinc.900}',
              950: '{zinc.950}',
            },
          },
          colorScheme: {
            light: {
              primary: {
                color: '{zinc.950}',
                inverseColor: '#ffffff',
                hoverColor: '{zinc.900}',
                activeColor: '{zinc.800}',
              },
              highlight: {
                background: '{zinc.950}',
                focusBackground: '{zinc.700}',
                color: '#ffffff',
                focusColor: '#ffffff',
              },
            },
            dark: {
              primary: {
                color: '{zinc.50}',
                inverseColor: '{zinc.950}',
                hoverColor: '{zinc.100}',
                activeColor: '{zinc.200}',
              },
              highlight: {
                background: 'rgba(250, 250, 250, .16)',
                focusBackground: 'rgba(250, 250, 250, .24)',
                color: 'rgba(255,255,255,.87)',
                focusColor: 'rgba(255,255,255,.87)',
              },
            },
          },
        }),
      },
    },
    components: {
      prefix: 'Prime',
    },
  },
  css: [
    '@/assets/styles/tailwind.css',
    '@/assets/styles/primeicons.css',
    '@/assets/styles/main.scss',
  ],
  vite: {
    plugins: [
      tailwindcss(),
    ],
    clearScreen: false,
    envPrefix: ['VITE_', 'TAURI_'],
    server: {
      strictPort: true,
      proxy: {
        '/api': {
          // target: 'http://localhost:4000/chad',
          target: 'https://api.koptilnya.xyz/chad',
          ws: true,
          changeOrigin: true,
          rewrite: (path) => {
            return path.replace(/^\/api/, '')
          },
        },
      },
    },
    define: {
      __API_BASE_URL__: JSON.stringify(import.meta.env.API_BASE_URL || 'http://localhost:4000/chad'),
      __COMMIT_SHA__: JSON.stringify(import.meta.env.COMMIT_SHA || 'local'),
    },
  },
  ignore: ['**/src-tauri/**'],
})
