/** * Settings service interface * Provides centralized settings management with validation, persistence, and reactive updates */ import type { Settings, DeepPartial, ValidationResult, SettingsListener, Unsubscribe } from './types'; export interface ISettingsService { /** * Initialize the service (load from storage, run migrations) * Must be called before other methods */ init(): Promise; /** * Get current settings (immutable) */ getSettings(): Settings; /** * Update settings (deep merge, validates, persists, emits event) * Returns updated settings on success * Throws SettingsValidationError if validation fails */ updateSettings(partial: DeepPartial): Promise; /** * Reset to default settings */ resetToDefaults(): Promise; /** * Load a preset (e.g., 'acs') */ loadPreset(name: string): Promise; /** * Get available preset names */ getAvailablePresets(): string[]; /** * Validate settings without applying */ validateSettings(settings: Partial): ValidationResult; /** * Export settings as JSON string */ exportSettings(): string; /** * Import settings from JSON string * Validates and applies the imported settings */ importSettings(json: string): Promise; /** * Subscribe to settings changes * Returns unsubscribe function */ subscribe(listener: SettingsListener): Unsubscribe; }