#pragma once

#include <Arduino.h>
#include <ArduinoJson.h>
#include "appVersion.h"

//#define FIRMWARE_VERSION "1.0.0"
#define FIRMWARE_VERSION_MAJOR 1
#define FIRMWARE_VERSION_MINOR 4
#define FIRMWARE_VERSION_PATCH 4

extern Version localVersion;

enum COMM_MODE { COMM_WIFI_AP_BLE, COMM_WIFI_AP_CLIENT };
extern enum  COMM_MODE commMode;

typedef struct{
  int count;
  TaskHandle_t handle[16];
}SYS_TASK_HANDLES;

extern SYS_TASK_HANDLES TaskList;

typedef struct{
  uint64_t chipMAC;
  uint8_t macByte[6];
  String macStr;
  //char chipID_2Hex[4];
  size_t app_partition_size;
  size_t app_partition_free;
}CHIP_INFO;

extern CHIP_INFO chipInfo;

// Stack, Heap and CPU Reporting
//#define ENABLE_SYSTEM_STATS 0

int findUnusedLedcChannel(void);
//void read_system_settings(void);
//void read_app_events_settings(void);
//void read_animations_list(void);
void report_system_stats(void);
void print_chip_info(void);
void get_chip_mac(char* macStr, size_t size);
void print_ram_info(void);
//void Pulse_LED_Status(int mSecs);
void printTaskInfo(void);
void printTaskCPUUsage(TaskHandle_t xTask);
void printTaskStackWatermark(TaskHandle_t xTask);
void addTaskHandleToList(SYS_TASK_HANDLES &list);
String getMacAddress(void);
String macToStr(uint8_t* mac);
bool updateJsonDocument(JsonDocument& doc, const char* filePath);

void Log_CPU_Load(void);

void print_task_watermarks(void);

