#pragma once
#include <cstdio>
#include <ctime>
#include <curl/curl.h> // tested with libcurl4-openSSH
#include <optional>
#include <sstream>
#include <string>

/*
	This class holds all the data retrieved from the Zeverlution combox /
	Zeverlution Sxxxx smart inverters / ZeverSolar box.

	For output formatting it uses a timestamp to log the datetime alongside the
	watts and kilowatts.
*/

struct ZeverData
{
    int number0, number1;
    std::string registeryID, registeryKey, hardwareVersion, appVersion, wifiVersion;
    std::string timeValue, dateValue, zeverCloudStatus;
    int number3;
    std::string inverterSN;
    int watt;
    double kilowattPerHour;
    std::string OKmsg, ERRORmsg;

    // Parses the data string coming from the zeverlution home.cgi webpage
    static std::optional<ZeverData> ParseString(const std::string & str);

    ZeverData();
};
