#include <Arduino.h>

#ifndef BEERBOX_IS_INCLUDED
#define BEERBOX_IS_INCLUDED


#define NUM_OF_PEOPLE 25
#define NUM_OF_DRINKS 10
#define DRINK_NAME_MAX_LENGTH 13
#define FILE_NAME_LEN 8
#define FILE_EXTENSION_LEN 3
#define FILE_EXTENSION "per"
#define NAME_LEN 10

extern int __drinks_taken;
extern int __drinks_put_in;

//Beware! Only valid inside the function it has been set in!
extern char tmp_filename[];

typedef struct{
  /*Drink spevifier*/
  char name[DRINK_NAME_MAX_LENGTH + 1];
  /*Value in cents*/
  int price;
}Drink;

typedef struct{
  Drink drinks[NUM_OF_DRINKS];
  int personCount;
}Beerbox;

typedef struct{
  char file_name[FILE_NAME_LEN + 1];
  
  char name[NAME_LEN + 1];
  char rfid_uuid[13];
  uint8_t finger_uuid;

  int drinks_taken[NUM_OF_DRINKS];
}Person;



Beerbox* read_beerbox(Beerbox *box);
Beerbox* add_drink(Beerbox *box);
Person read_person(Beerbox *box, char *filename);
void print_person(Beerbox *box, Person *aperson);
int update_pers_file(Beerbox *box, Person *aperson);

char* read_line_from_file(FILE *stream, char *str, int max_len);
char* read_from_file_until(FILE *stream, char *str, int max_len, char until);
#endif
