// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  future: {
    compatibilityVersion: 4,
  },
  srcDir: "app/",
  compatibilityDate: "2024-11-01",
  devtools: { enabled: true },

  modules: ["@nuxt/ui", "@nuxt/content", "nuxt-auth-utils", "@vueuse/nuxt"],

  runtimeConfig: {
    // Private runtime config (server-side only)
    mongodbUri:
      process.env.MONGODB_URI || "mongodb://localhost:27017/wiki-ghostguild",
    jwtSecret: process.env.JWT_SECRET || "your-secret-key-change-in-production",
    ghostguildApiUrl:
      process.env.GHOSTGUILD_API_URL || "https://ghostguild.org/api",
    ghostguildApiKey: process.env.GHOSTGUILD_API_KEY || "",
    ghostguildClientId: process.env.GHOSTGUILD_CLIENT_ID || "",
    ghostguildClientSecret: process.env.GHOSTGUILD_CLIENT_SECRET || "",

    // Public runtime config (client-side)
    public: {
      siteUrl: process.env.SITE_URL || "https://wiki.ghostguild.org",
      siteName: "Ghost Guild Knowledge Commons",
      siteDescription: "A wiki for ghosts! 👻",
    },
  },

  nitro: {
    experimental: {
      wasm: true,
    },
    prerender: {
      routes: ["/", "/articles", "/articles/new"],
      failOnError: false,
    },
  },

  typescript: {
    strict: true,
    typeCheck: true,
  },

  css: ["~/assets/css/main.css"],

  app: {
    head: {
      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=Crimson+Text:ital,wght@0,400;0,600;0,700;1,400;1,600&display=swap",
        },
      ],
    },
  },

  vite: {
    build: {
      minify: "esbuild",
    },
  },
});
