#include <Arduino.h>
#include <SimpleStack.h>

int stackSize = 10;
SimpleStack<char*> K1(stackSize);

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Serial.println("Hello, ESP32-S3!");
}

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

  K1.push("clear");
  K1.push("get");
  K1.push("remove");
  K1.push("set");

  char* retrieve;
  int currentCount = 0;

  int stackSize = K1.getSize();
  printf("Stack Size: %i\n", K1.getSize());
  printf("Stack Size: %i\n", stackSize);

  
  // Counting down as the LIFO (Last In First Out) file 
  // structure recognizes it's first member as the last put in
  for(int i = 10; i >= 0; i--) {
    if(K1.get(i, &retrieve) > 0) {
      currentCount++;
      printf("Item #%i: %s\n", currentCount, retrieve);
    }
  }
    /* OPUTPUT
    Item #1: set
    Item #2: remove
    Item #3: get
    Item #4: clear
    */
  // Peek at the first value and 
  // store it in a variable to print

  K1.peek(&retrieve);
  printf("Peek = %s\n", retrieve);
    /* OUTPUT
    Peek = set
    */


delay(60000);
}