#pragma once

#include "GameDisplay.h"
#include "LedRing.h"
#include "GameBuzzer.h"
#include "Player.h"

#ifndef SERVICE_HARDRESET_DURATION_MS
#define SERVICE_HARDRESET_DURATION_MS 5000ul
#endif

#ifndef SERVICE_BRIGHTNESS_UPDATE_ENABLED
#define SERVICE_BRIGHTNESS_UPDATE_ENABLED FALSE
#endif

#ifndef SERVICE_BRIGHTNESS_UPDATE_DELAY_MS
#define SERVICE_BRIGHTNESS_UPDATE_DELAY_MS 500ul
#endif

#ifndef SERVICE_HITPOINTS_HALF
#define SERVICE_HITPOINTS_HALF 1
#endif

#ifndef SERVICE_HITPOINTS_FULL
#define SERVICE_HITPOINTS_FULL 2
#endif


class CycloneService {
  private:
    volatile bool m_buttonFlag;
    unsigned long m_lastButtonPressDuration;
    const int m_BrightnessPin;
    unsigned long m_lastBrightnessUpdate;
    GameDisplay m_gameDisplay;
    LedRing m_ledRing;
    GameBuzzer m_gameBuzzer;
    Player m_player;

    static void animationCallback(ERingAnimation, void*);
    void brightnessUpdate(void);
    void hitRoutine(bool);
    void missRoutine(void);

  public:
    CycloneService(const int, const int, const int, const int, const int, const int, const int,
                   const int, const int, const int, const int, const int, const int, const int);
    void init(void);
    void update(void);
    void onActionButton(bool);
};