const withImages = require('next-images');
const withFonts = require('next-fonts');
const withLess = require("next-with-less");

module.exports = withImages(withFonts(withLess({
	images: {
		domains: [ 'lk-evo.quickcode.ru', 'wow.evoleasing.ru', 'www.evoleasing.ru', 'lk.evoleasing.ru', 'evoleasing.ru', 'localhost', 'localhost:3000'],
	},
	reactStrictMode: false,
	/*
	async headers() 
	{
		return [
			{
				source: '/api/:path*',
				headers: [
					{
						key: 'Access-Control-Allow-Origin',
						value: '*',
					},
					{
						key: 'Access-Control-Allow-Methods',
						value: 'POST, GET, OPTIONS',
					}
				],
			},
		]
	},
	*/
	async redirects() 
	{
		return [ 
			{ 
				source: '/support', 
				destination: '/support/faq', 
				permanent: false,
			}, 
			//{ 
				//source: '/special', 
				//destination: '/special/with_producer', 
				//permanent: true,
			//}, 
		]
	},
	async rewrites() 
	{
		return {
			afterFiles: [
				{
					source: "/contract/:number/payments", 
					destination: "/contract", 
				}, 
				{
					source: "/contract/:number/agreement", 
					destination: "/contract/agreement", 
				}, 
				{
					source: "/contract/:number/services", 
					destination: "/contract/services", 
				}, 
				{
					source: "/contract/:number/documents", 
					destination: "/contract/documents", 
				}, 
				{
					source: "/contract/:number/penalties", 
					destination: "/contract/penalties", 
				}, 
				{
					source: "/contract/:number/materials", 
					destination: "/contract/materials", 
				}, 
				{
					source: "/contract/:number/events", 
					destination: "/contract/events", 
				}, 
				{
					source: "/contract/:number/fines", 
					destination: "/contract/fines", 
				}, 
				{
					source: "/contract/:number/change", 
					destination: "/contract/change", 
				}, 
				{
					source: "/support/faq", 
					destination: "/support", 
				}, 
				//{ 
					//source: "/about/reviews/:page(\\d{1,})", 
					//destination: "/about/reviews", 
				//}, 
			],
		}
	}
})));