package services import ( "voicesnap/internal/config" "voicesnap/internal/dock" "voicesnap/internal/startup" ) // ConfigService provides configuration read/write methods to the frontend. type ConfigService struct { cfg *config.Config } func NewConfigService(cfg *config.Config) *ConfigService { return &ConfigService{cfg: cfg} } // GetConfig returns the current configuration. func (s *ConfigService) GetConfig() *config.Config { return s.cfg } // SetAutoHide sets the auto-hide indicator preference. func (s *ConfigService) SetAutoHide(enabled bool) { s.cfg.AutoHide = enabled config.Save(s.cfg) } // GetAutoHide returns the auto-hide preference. func (s *ConfigService) GetAutoHide() bool { return s.cfg.AutoHide } // SetSoundFeedback sets the sound feedback preference. func (s *ConfigService) SetSoundFeedback(enabled bool) { s.cfg.SoundFeedback = enabled config.Save(s.cfg) } // GetSoundFeedback returns the sound feedback preference. func (s *ConfigService) GetSoundFeedback() bool { return s.cfg.SoundFeedback } // SetCopyToClipboard sets whether recognized text remains in the clipboard after input. func (s *ConfigService) SetCopyToClipboard(enabled bool) { s.cfg.CopyToClipboard = enabled config.Save(s.cfg) } // GetCopyToClipboard returns whether recognized text remains in the clipboard after input. func (s *ConfigService) GetCopyToClipboard() bool { return s.cfg.CopyToClipboard } // SetHideDockIcon sets whether the app should hide its Dock icon on macOS. func (s *ConfigService) SetHideDockIcon(enabled bool) { s.cfg.HideDockIcon = enabled config.Save(s.cfg) dock.SetHidden(enabled) } // GetHideDockIcon returns whether the Dock icon should be hidden. func (s *ConfigService) GetHideDockIcon() bool { return s.cfg.HideDockIcon } // IsStartupEnabled returns whether the app is set to start at login. func (s *ConfigService) IsStartupEnabled() bool { return startup.IsEnabled() } // SetStartupEnabled enables or disables start at login. func (s *ConfigService) SetStartupEnabled(enabled bool) error { return startup.SetEnabled(enabled) }