#include <Arduino.h>
#include <memory>
#include "Category.h"
#include "C2.h"

void serialPrintFreeHeap() {
  Serial.println("[APP] Free memory: " + String(esp_get_free_heap_size()) + " bytes");
}

void serialPrintEnum(const Enum *e) {
  Serial.print((int)e->id);
  Serial.print(" ");
  Serial.println(e->name);
}

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  
  serialPrintFreeHeap();

  serialPrintEnum(Category::getValueById(0x01));
  serialPrintEnum(C2::getValueById(0x00));
}

void loop() {
  // put your main code here, to run repeatedly:
  delay(100); // this speeds up the simulation

  //auto e = std::shared_ptr<Enum>(new Category(0x00, "test"));
  //auto e = Category::CAR_STATUS;
  //Enum *e = new Category(0x00, "test");

  for(uint8_t i = 0; i < Category::getSize(); i++) {
    auto e = Category::getValues()[i];
    serialPrintEnum(e);
  }

  for(uint8_t i = 0; i < C2::getSize(); i++) {
    auto e = C2::getValues()[i];
    serialPrintEnum(e);
  }
  
  //delete e;

  serialPrintFreeHeap();
}