import { createResolver } from "@nuxt/kit";
const { resolve } = createResolver(import.meta.url);
// https://nuxt.com/docs/api/configuration/nuxt-config

export default defineNuxtConfig({
  devtools: { enabled: true },
  
  nitro: {
    preset: 'iis_node'
  },

  app: {
    head: {
      link: [],
    },
  },

  modules: [
    '@nuxt/image',
    "@unocss/nuxt",
    "@vueuse/nuxt",
    "@pinia/nuxt",
    "nuxt-delay-hydration",
    "nuxt-icon",
    "dayjs-nuxt",
    '@ant-design-vue/nuxt',
  ],

  runtimeConfig: {
    public: {
      apiUrl: "http://api-portal.vpress.vn/api-v1",
      site: process.env.NUXT_PUBLIC_SITE_DEFAULT || "1",
    },
    authSecret: process.env.AUTH_SECRET||"vpress"
  },

  alias: {
    "@": resolve(__dirname, "./"),
    "~": resolve(__dirname, "./"),
  },

  css: ["@/assets/styles/style.scss", "@/assets/styles/app.sass", "@unocss/reset/tailwind-compat.css"],

  // dayjs
  dayjs: {
    locales: ["vi"],
    plugins: ["relativeTime", "utc", "timezone"],
    defaultTimezone: "Asia/Ho_Chi_Minh",
    defaultLocale: ["vi", {
      weekdays: 'Chủ nhật_Thứ Hai_Thứ Ba_Thứ Tư_Thứ Năm_Thứ Sáu_Thứ Bảy'.split('_'),
    }],
  },

  // pinia
  pinia: {
    autoImports: [
      'defineStore', // import { defineStore } from 'pinia'
      ['defineStore', 'definePiniaStore'], // import { defineStore as definePiniaStore } from 'pinia'
      'storeToRefs',
      'acceptHMRUpdate',
    ],
  },

  vue: {
    defineModel: true,
    runtimeCompiler: true,
    propsDestructure: true,
  },

  ssr: true,
  routeRules: {
    '**': { ssr: true },
  },

  typescript: {
    shim: false,
  },
});
