#pragma once

#ifndef GAMEBUZZ_DELAY_MS
#define GAMEBUZZ_DELAY_MS 100ul
#endif


enum class EGameSound {
  NONE,
  HIT,
  MISS,
  GAME_OVER,
  RESET,
};

class GameBuzzer {
  private:
    const int m_pin;
    unsigned long m_lastUpdateMs;
    EGameSound m_currentSound;
    int m_stepCounter;
    
    bool hitRoutine(void);
    bool missRoutine(void);
    bool gameOverRoutine(void);
    bool resetRoutine(void);

  public:
    GameBuzzer(const int);
    void init(void);
    void update(void);
    bool isBusy(void) { return (m_currentSound != EGameSound::NONE); }
    void playSound(EGameSound);
};