#pragma once

#include <stdbool.h>
#include <time.h>
#include "esp_event.h"

#ifdef __cplusplus
extern "C" {
#endif

ESP_EVENT_DECLARE_BASE(TIME_SERVICE_EVENTS);

typedef enum {
    TIME_SERVICE_EVENT_INIT = 0,
    TIME_SERVICE_EVENT_SYNC_STARTED,
    TIME_SERVICE_EVENT_SYNC_OK,
    TIME_SERVICE_EVENT_SYNC_TIMEOUT,
    TIME_SERVICE_EVENT_NETWORK_LOST,
} time_service_event_id_t;

typedef struct {
    bool timezone_configured;
    bool sntp_initialized;
    bool sync_in_progress;
    bool synced;
    bool valid_time;
    time_t now;
} time_service_state_t;

#ifdef __cplusplus
}
#endif
