#pragma once
#include "time.h"
#include "stdbool.h"
#include "stateManagement.h"

   /*struct node {
        struct node *next;
        int e;
        };

    struct Hashtable {
        unsigned Tablesize;
        struct node *Cells;
        };
        */

    struct dailyforecast_prev
    {
        float min;
        float max;
        char desc[25];
        char icon[9];
    };

    struct forecast_prev
    {
        float value;
        char desc[25];
        char icon[9];
    };

    typedef struct meteodailyforecast_data
    {
        time_t datetime;
        bool isValid;
        struct dailyforecast_prev previsions;
    } meteodailyforecast_data;

    typedef struct meteoforecast_data
    {
        time_t datetime;
        bool isValid;
        struct forecast_prev previsions;
    } meteoforecast_data;

    typedef void (*weather_data_callback)(struct meteodailyforecast_data *datas, struct meteoforecast_data *datasf);
    typedef void (*weather_data_start_callback)();

    typedef struct
    {
        unsigned int humidity;
        float temperature;
        float pressure;
        unsigned long retreival_period;
        weather_data_callback data_retreived_cb;
        weather_data_start_callback data_retreived_cb_start;
    } weather_data;

    void printdftemp(struct dailyforecast_prev * tmp);
    void printftemp(struct forecast_prev * tmp);
    void printfdf(struct meteodailyforecast_data * tmp);
    void dtToString(time_t, char *buffer);
    void dtHToString(time_t, char *buffer);
    void printff(struct meteoforecast_data * tmp);

    void on_weather_data_retrieval(weather_data_callback data_retreived_cb);
    void on_weather_data_retrieval_start(weather_data_callback data_retreived_cb);
    void initialise_weather_data_retrieval(unsigned long retreival_period, void *evtGroup);
