#pragma once

#include <ArduinoJson.h>


typedef enum {
  TUNE_BOOT,
  TUNE_SHUTDOWN,
  TUNE_CONNECTED,
  TUNE_DISCONNECTED,
  TUNE_DONE,
  TUNE_WARNING,
  TUNE_ERROR,
  TUNE_BLIP,
  TUNE_THUMP,
  TUNE_ACK,
  TUNE_WAITING,
  TUNE_LOWBEEP,
  TUNE_HIGHBEEP
}TUNE_TYPE;

//Tunes
typedef struct {
  bool enabled;
  int cycles;
  int pause;
  String melody;
}BUZZ_TUNE;

#define TUNE_MAX_COUNT 12

extern BUZZ_TUNE buzzTune[TUNE_MAX_COUNT];

void Init_Buzzer(int8_t, const char* configPath);

void Buzzer_Beep(int, int freq=1000);

void Buzzer_Load_Tunes(const char* tunesPath);

void Buzzer_Play_Tune(TUNE_TYPE, bool async=true, bool priority=true);

