import type { Config } from './schema';
import { baseConfig } from './base';

// Development-specific configuration overrides
// Relaxed security settings for local development
export const developmentConfig: Partial<Config> = {
	server: {
		...baseConfig.server,
		port: 3001,
		backendUrl: 'http://localhost:3001',
		frontendUrl: 'http://localhost:3000,http://localhost:3001',
	},
	database: {
		...baseConfig.database,
		host: 'localhost',
		port: 5432,
		connectionString: 'postgres://postgres:postgres@localhost:5432/sso',
		readHost: '',
		readPort: 5432,
	},
	redis: {
		...baseConfig.redis,
		enabled: false,
	},
	redisA: {
		...baseConfig.redisA,
		enabled: false,
	},
	auth: {
		...baseConfig.auth,
		bcryptRounds: 4, // Faster hashing for development
		includeTokensInResponse: true, // Easier debugging
		skipSensitiveConfirm: true, // Faster development workflow
		enableRegister: true,
	},
	cookie: {
		...baseConfig.cookie,
		domain: '.meucorp.com',
		forceSecure: false, // Allow HTTP in development
		devSameSiteLax: true, // More permissive for local testing
	},
	uploads: {
		...baseConfig.uploads,
		maxFileSize: 10485760, // 10MB
	},
	storage: {
		...baseConfig.storage,
		provider: 'local', // Use local storage in development
		publicBaseUrl: 'http://localhost:3001',
		minio: {
			...baseConfig.storage.minio,
			endpoint: 'localhost',
			port: 9000,
			useSSL: false, // No SSL in development
		},
	},
	notifications: {
		rateLimiting: {
			maxLoginAttempts: 100, // Very permissive for development
			lockoutDurationMinutes: 1, // Short lockout for development
			rateLimitWindowMs: 60000,
			rateLimitOnesignalMax: 100,
			rateLimitZaloMax: 50,
			rateLimitEmailMax: 200,
		},
		maxRetries: 3,
	},
	csrf: {
		originValidation: false, // Disabled for development
		doubleSubmit: false, // Disabled for development
		httpOnly: false, // Disabled for development
		devSameSiteLax: true,
		allowedOrigins: [],
	},
	virusScan: {
		enabled: false, // Disable virus scan in development
	},
	logging: {
		level: 'info', // Verbose logging in development
	},
	cors: {
		devDisable: true, // Disable CORS restrictions in development
	},
	featureFlags: {
		enableRedis: false,
		enableVirusScan: false,
		enableCSRF: false,
		enableRateLimit: false, // Disable rate limiting in development
		showStackInErrors: true,
		fileListUrlConcurrency: 5,
		maxSimpleFallbackSize: 5000,
		maxFallbackMapSize: 10000,
	},
};
