// https://nuxt.com/docs/api/configuration/nuxt-config
import { createResolver } from '@nuxt/kit'
import { process } from 'std-env'

const { resolve } = createResolver(import.meta.url)

export default defineNuxtConfig({
  ssr: true,
  compatibilityDate: '2025-05-15',
  devtools: { enabled: true },
  modules: [
    '@nuxt/ui',
    '@nuxt/image',
    '@nuxt/icon',
    '@nuxt/fonts',
    '@nuxtjs/i18n',
    [
      '@vee-validate/nuxt',
      {
        autoImports: true,
      },
    ],
    'vue-yandex-maps/nuxt',
  ],
  yandexMaps: {
    apikey: process.env.VITE_YANDEX_MAPS_KEY,
  },
  css: ['~/assets/css/main.css', '~/assets/scss/main.scss'],
  colorMode: {
    preference: 'dark',
    fallback: 'dark',
    storageKey: 'color-mode',
    classSuffix: '',
    dataValue: 'dark',
  },
  build: {
    transpile: ['gsap'],
  },
  i18n: {
    locales: [
      { code: 'en', name: 'English', file: 'en.json' },
      { code: 'ru', name: 'Русский', file: 'ru.json' },
    ],
    defaultLocale: 'ru',
    strategy: 'prefix_except_default',
    detectBrowserLanguage: false,
  },
  app: {
    head: {
      link: [
        { rel: 'icon', type: 'image/svg+xml', href: '/main-logo.svg' },
      ],
      meta: [
        {
          name: 'viewport',
          content: 'width=device-width, initial-scale=1, maximum-scale=1, viewport-fit=cover, user-scalable=no',
        },
      ],
    },
  },
  vite: {
    css: {
      preprocessorOptions: {
        scss: {
          additionalData: `@use "${resolve('./assets/scss/mixins')}" as *;`,
        },
      },
    },
  },
  fonts: {
    provider: 'google',
  },
  icon: {
    customCollections: [
      {
        prefix: 'my-icon',
        dir: './assets/my-icons',
      },
    ],
  },
})
