/****************************************************************************
 * This file is part of the project AqHome.
 * AqHome (c) by 2024 Martin Preuss, all rights reserved.
 *
 * The license for this file can be found in the file COPYING which you
 * should have received along with this file.
 ****************************************************************************/

#ifndef AQH_STORAGE_P_H
#define AQH_STORAGE_P_H


#include "aqhome/data/storage.h"
#include "aqhome/data/datafile.h"


#define AQH_STORAGE_XML_ELEMENTNAME_LASTIDS  "lastIds"

#define AQH_STORAGE_XML_ELEMENTNAME_VALUES   "values"
#define AQH_STORAGE_XML_ELEMENTNAME_VALUE    "value"

#define AQH_STORAGE_XML_ELEMENTNAME_DEVICES  "devices"
#define AQH_STORAGE_XML_ELEMENTNAME_DEVICE   "device"



struct AQH_STORAGE {
  GWEN_INHERIT_ELEMENT(AQH_STORAGE)

  AQH_VALUE_LIST *valueList;
  AQH_DEVICE_LIST *deviceList;

  uint64_t lastValueId;
  uint64_t lastDeviceId;

  char *stateFile;
  char *dataFileFolder;

  AQH_DATAFILE_LIST *dataFileList;

  uint32_t runtimeFlags;

  AQH_STORAGE_INIT_FN initFn;
  AQH_STORAGE_FINI_FN finiFn;
  AQH_STORAGE_ADDDATAPOINT_FN addDatapointFn;
  AQH_STORAGE_GETDATAPOINTS_FN getDatapointsFn;
  AQH_STORAGE_GETFIRSTDATAPOINT_FN getFirstDatapointFn;
  AQH_STORAGE_GETLASTDATAPOINT_FN getLastDatapointFn;
  AQH_STORAGE_GETLASTNDATAPOINTS_FN getLastNDatapointsFn;
  AQH_STORAGE_GETFIRSTNDATAPOINTS_FN getFirstNDatapointsFn;
};



#endif


