// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  app: {
    head: {
      title: "RSSA",
      titleTemplate: "%s - Antrean Operasi",
      meta: [
        { charset: "utf-8" },
        { name: "viewport", content: "width=device-width, initial-scale=1" },
        { name: "format-detection", content: "telephone=no" }
      ],
      link: [
        { rel: "icon", type: "image/x-icon", href: "/favicon.ico" },
        {
          rel: "stylesheet",
          href: "https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap"
        }
      ]
    }
  },
  // css: [
  //   "vuetify/lib/styles/main.sass", // Core Vuetify styles
  //   "@mdi/font/css/materialdesignicons.min.css", // Material Design Icons
  //   "~/scss/style.scss", // Custom application styles
  // ],
  /**
   * Modules dan plugins
   * Integrasi dengan ecosystem Nuxt.js
   */
  modules: [
    "@pinia/nuxt", // State management dengan Pinia  
  ],

  plugins: [
    "~/plugins/vuetify.ts" // Setup Vuetify dengan konfigurasi custom
  ],
  ssr: false,

  typescript: {
    shim: false
  },

  build: {
    transpile: ["vuetify"]
  },

  vite: {
    define: {
      "process.env.DEBUG": false
    },
    server: {
      allowedHosts: ["meninjar.dev.rssa.id"]
    }
    // css: {
    //   preprocessorOptions: {
    //     scss: {
    //       // Global SCSS variables yang dapat diakses di semua komponen
    //       additionalData: `@import "~/scss/variables.scss";`,
    //     },
    //   },
    // },
  },

  nitro: {
    serveStatic: true,
    compressPublicAssets: true, // Kompresi asset untuk faster loading,

    /**
     * Prerender routes untuk static generation
     * Halaman yang akan di-generate saat build time
     */
    prerender: {
      // routes: [
      //     '/', // Landing page
      //     '/auth/login', // Halaman login
      //     '/auth/register' // Halaman register
      // ]
    }

    /**
     * Route protection untuk production
     * Middleware untuk security dan rate limiting
     */
    // routeRules: {
    //     '/admin/**': {
    //         headers: { 'X-Robots-Tag': 'noindex' }
    //         // index: false // ❌ Property ini tidak valid - sudah dihapus
    //     }
    // }
  },
    runtimeConfig: {
    authSecret: process.env.NUXT_AUTH_SECRET,
    keycloakClientId: process.env.KEYCLOAK_CLIENT_ID,
    keycloakClientSecret: process.env.KEYCLOAK_CLIENT_SECRET,
    keycloakIssuer: process.env.KEYCLOAK_ISSUER,
    keycloakLogoutUri: process.env.KEYCLOAK_LOGOUT_URI, // Optional: custom logout URI
    postLogoutRedirectUri: process.env.POST_LOGOUT_REDIRECT_URI, // Optional: custom post-logout redirect URI
    public: {
      authUrl: process.env.AUTH_ORIGIN,
      // authUrl: process.env.AUTH_ORIGIN || "http://10.10.150.175:3001",
      // authUrl: process.env.AUTH_ORIGIN || "http://localhost:3001",
      wsBaseUrl: process.env.WS_BASE_URL || 'ws://10.10.150.100:8084/api/v1/ws',
      baseUrl: process.env.BASE_URL || 'http://localhost:8080/api',
      baseUrlGomed: process.env.BASE_URL_GOMED || 'https://gomed.rssa.my.id/api',
    },
  },
  // auth: {
  //   isEnabled: true,
  //   baseURL: process.env.AUTH_ORIGIN,
  //   provider: {
  //     type: "authjs",
  //   },
  //   globalAppMiddleware: {
  //     isEnabled: true,
  //   },
  // },
  devServerHandlers: [],

  hooks: {},
  /**
   * Development tools configuration
   * Tools untuk meningkatkan developer experience
   */
  devtools: {
    enabled: true, // Enable Nuxt DevTools untuk debugging
    timeline: {
      enabled: true // Enable timeline untuk performance monitoring
    }
  },

  compatibilityDate: "2025-07-25"
});
