export default defineNuxtConfig({
	compatibilityDate: '2025-08-22',
	devtools: { enabled: true },
	srcDir: 'src',
	alias: {
		'@': '~/',
	},
	app: {
		head: {
			title: '明阳良光',
			meta: [
				{ charset: 'utf-8' },
				{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
				{ name: 'description', content: '明阳良光' },
				{ name: 'theme-color', content: '#4f8cef' }
			],
			link: [
				{ rel: 'icon', href: '/favicon.ico' }
			]
		}
	},
	// 静态生成配置
	nitro: {
		preset: 'static'
	},
	// 预渲染配置
	routeRules: {
		'/': { prerender: true },
		'/about-us': { prerender: true },
		'/contact-us': { prerender: true },
		'/product': { prerender: true },
		'/product/detail': { prerender: true },
		'/product/rich-detail': { prerender: true },
		'/privacy-policy': { prerender: true },
		'/thanks': { prerender: true },

		// 中文路由预渲染（因为默认是英文，所以中文需要前缀）
		'/cn': { prerender: true },
		'/cn/about-us': { prerender: true },
		'/cn/contact-us': { prerender: true },
		'/cn/product': { prerender: true },
		'/cn/product/detail': { prerender: true },
		'/cn/product/rich-detail': { prerender: true },
		'/cn/privacy-policy': { prerender: true },
		'/cn/thanks': { prerender: true }
	},
	plugins: [
		'~/plugins/vue-lazyload.js',
		{ src: '~/plugins/aos-client.js', mode: 'client' },
		'~/plugins/vue-dompurify-html.js',
		'~/plugins/image-path.js',
		{ src: '~/plugins/static-data.client.js', mode: 'client' }
	],
	devServer: {
		port: 1110,
	},
	modules: ['@nuxtjs/i18n', '@pinia/nuxt'],
	i18n: {
		locales: [
			{ code: 'en', name: 'English' },
			{ code: 'cn', name: '简体中文' }
		],
		defaultLocale: 'en',
		detectBrowserLanguage: {
			useCookie: true,
			cookieKey: 'i18n_redirected',
			redirectOn: 'root',
			alwaysRedirect: false,
			fallbackLocale: 'en',
			cookieSecure: false
		},
		strategy: 'prefix_except_default',
		vueI18n: '~/i18n.config.ts'
	},
	// Axios配置
	runtimeConfig: {
		public: {
			apiBaseUrl: process.env.API_BASE_URL || 'https://api.example.com'
		}
	}
})