const say = require('say');

let voiceEnabled = false;

export const setVoiceEnabled = (enabled: boolean) => {
  voiceEnabled = enabled;
};

export const speak = (text: string) => {
  if (voiceEnabled) {
    say.speak(text);
  }
};

export const isVoiceEnabled = (): boolean => {
  return voiceEnabled;
};

const stop = () => {
  say.stop();
};

export const narrator = {
  stop,
};
