// ============================================================================
// TERMINAL DISPLAY SETTINGS
// ============================================================================

export type SpeedPreset = 'instant' | 'fast' | 'normal' | 'slow' | 'typewriter';

export interface TerminalSettings {
	baseTypeSpeed: number;
	minTypeSpeed: number;
	maxTypeSpeed: number;
	startDelay: number;
	lineDelay: number;
	showCursor: boolean;
	promptStyle: 'full' | 'short' | 'minimal';
	icon: string;
	scrollMargin: number;
}

export const terminalSettings: TerminalSettings = {
	// Base typing speed in ms per character (will be adjusted by content length)
	baseTypeSpeed: 20,
	// Minimum typing speed (fastest)
	minTypeSpeed: 5,
	// Maximum typing speed (slowest)
	maxTypeSpeed: 50,
	// Delay before starting to type (ms)
	startDelay: 300,
	// Delay between lines (ms)
	lineDelay: 100,
	// Show cursor
	showCursor: true,
	// Prompt style
	promptStyle: 'full',
	// Terminal icon (emoji or text)
	icon: '🐧',
	// Scroll margin when navigating buttons (px)
	scrollMargin: 80,
};

// ============================================================================
// TUI (Terminal UI) STYLING
// ============================================================================

export const tuiStyle = {
	// Border & container
	borderRadius: 8, // px
	borderWidth: 2, // px
	width: '95%',
	borderGlowOpacity: 0.5,
	borderGlowBlur: 4, // px

	// Header
	headerPadding: '0.5rem 0.75rem',
	headerFontSize: '0.8rem',

	// Body
	bodyPadding: '1rem 1.25rem 2rem 1.25rem',
	bodyFontSize: '0.9rem',
	lineHeight: 1.7,
	lineMinHeight: '1.7em',
	blankLineHeight: '0.5em',

	// Divider
	dividerMargin: '0.75rem 0',

	// Images
	imageBorderRadius: 6, // px
	defaultImageWidth: 300, // px

	// Cursor
	cursorWidth: 8, // px

	// Scrollbar
	scrollbarWidth: 6, // px

	// Footer/Statusbar
	statusbarPadding: '0.4rem 0.75rem',
	statusbarFontSize: '0.75rem',
	hintFontSize: '0.7rem',
	hintBorderRadius: 3, // px

	// Buttons
	buttonPadding: '0.5rem 0.75rem',
	buttonMargin: '0.2rem 0',
	buttonBorderRadius: 4, // px
	buttonFontSize: '0.9rem',
	buttonIndicatorFontSize: '0.8rem',
	buttonIndicatorWidth: '1rem',
};

// ============================================================================
// TUI TEXT & INDICATORS
// ============================================================================

export const tuiText = {
	// Status text
	loading: 'Loading...',
	ready: 'Ready',
	skipButton: 'Skip (Y)',
	tuiLabel: 'TUI',

	// Keyboard hints
	hints: {
		navigate: '↑↓ navigate',
		select: '⏎ select',
		toggle: 'T theme',
	},

	// Line prefixes
	prefixes: {
		error: '✗ ',
		success: '✓ ',
		info: '› ',
		warning: '⚠ ',
		command: '$ ',
	},

	// Button indicators
	buttonIndicator: {
		selected: '▶',
		unselected: ' ',
	},
};

// ============================================================================
// Per-page speed settings (override global settings)
// Use preset names or custom multiplier (0.1 = 10x faster, 2 = 2x slower)
// ============================================================================

export const pageSpeedSettings: Record<string, SpeedPreset | number> = {
	// Examples:
	// 'home': 'fast',        // Fast typing on home page
	// 'portfolio': 'normal', // Normal speed
	// 'models': 'instant',   // No typing animation
	// 'hackathons': 0.5,     // Custom: 2x faster than normal
	'home': 'fast',
	'portfolio': 'instant',
	'models': 'fast',
	'projects': 'fast',
	'components': 'fast'
};

// Per-page autoscroll settings (whether to auto-scroll as content types)
// Set to false to disable autoscroll on specific pages
export const pageAutoscrollSettings: Record<string, boolean> = {
	// Examples:
	// 'home': true,          // Enable autoscroll
	// 'portfolio': false,    // Disable autoscroll
	'home': true,
	'portfolio': false,
	'models': false,
	'projects': false,
	'components': false
};

// Speed preset multipliers (lower = faster)
export const speedPresets: Record<SpeedPreset, number> = {
	'instant': 0,      // No delay, instant display
	'fast': 0.1,       // 3x faster
	'normal': 0.5,       // Default speed
	'slow': 1.5,         // 2x slower
	'typewriter': 2    // 3x slower, classic typewriter feel
};

// ============================================================================
// MODEL VIEWER (3D)
// ============================================================================

export const modelViewer = {
	// Container
	borderRadius: 8, // px
	minHeight: 300, // px
	headerPadding: '0.5rem 0.75rem',
	nameFontSize: '0.85rem',

	// Controls
	controlButtonSize: 28, // px
	controlButtonBorderRadius: 4, // px
	fullscreenZIndex: 100,
	fullscreenTopOffset: 60, // px (navbar height)

	// Camera
	cameraFov: 45,
	cameraNear: 0.1,
	cameraFar: 1000,
	cameraZ: 2.5, // initial camera distance

	// Controls behavior
	controlsMinDistance: 1,
	controlsMaxDistance: 10,
	dampingFactor: 0.05,
	autoRotateSpeed: 2,

	// Model
	modelScale: 1.5,

	// Ground plane
	groundColor: 0x222222,
	groundOpacity: 0.3,

	// Lighting
	ambientIntensity: 0.6,
	directionalIntensity: 0.8,
	lightColor: 0xffffff,
	rimLightColor: 0x88ccff,

	// Text
	loadingText: 'Loading model...',
	errorText: 'Failed to load model',
	hints: {
		rotate: 'Drag to rotate',
		zoom: 'Scroll to zoom',
	},

	// Timing
	resizeTimeout: 100, // ms
};

// ============================================================================
// PARTICLES (3D Background)
// ============================================================================

export const particles = {
	count: 400,
	spreadArea: 20,
	size: 0.1,
	velocityRange: 0.01,

	// Opacity
	darkOpacity: 0.6,
	lightOpacity: 0.4,

	// Motion
	waveAmplitude: 0.001,
	waveFrequency: 0.1,
	boundary: 10, // wrap boundary
	rotationSpeedY: 0.05,
	rotationSpeedX: 0.02,
};

// ============================================================================
// KEYBOARD SHORTCUTS
// ============================================================================

export const keyboardShortcuts = {
	skip: ['y', 'Y'],           // Skip typing animation
	toggleTheme: ['t', 'T'],    // Toggle dark/light mode
	navigateUp: ['ArrowUp', 'k'],
	navigateDown: ['ArrowDown', 'j'],
	select: ['Enter'],
};
