/****************************************************************************
 * This file is part of the project AqHome.
 * AqHome (c) by 2025 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 AQHOME_REACT_DATAOBJECT_H
#define AQHOME_REACT_DATAOBJECT_H


#include <gwenhywfar/list.h>
#include <gwenhywfar/buffer.h>


typedef struct AQHREACT_DATAOBJECT AQHREACT_DATAOBJECT;
GWEN_LIST_FUNCTION_DEFS(AQHREACT_DATAOBJECT, AQHREACT_DataObject)


enum {
  AQHREACT_DATAOBJECTTYPE_UNKNOWN=0,
  AQHREACT_DATAOBJECTTYPE_DOUBLE,
  AQHREACT_DATAOBJECTTYPE_STRING,
  AQHREACT_DATAOBJECTTYPE_INT
};


#include "aqhome-react/server.h"



AQHREACT_DATAOBJECT *AQHREACT_DataObject_new();
void AQHREACT_DataObject_free(AQHREACT_DATAOBJECT *dataObject);
AQHREACT_DATAOBJECT *AQHREACT_DataObject_dup(const AQHREACT_DATAOBJECT *origObject);


uint64_t AQHREACT_DataObject_GetValueId(const AQHREACT_DATAOBJECT *dataObject);
void AQHREACT_DataObject_SetValueId(AQHREACT_DATAOBJECT *dataObject, uint64_t i);

const char *AQHREACT_DataObject_GetSystemValueId(const AQHREACT_DATAOBJECT *dataObject);
void AQHREACT_DataObject_SetSystemValueId(AQHREACT_DATAOBJECT *dataObject, const char *s);

const char *AQHREACT_DataObject_GetValueUnits(const AQHREACT_DATAOBJECT *dataObject);
void AQHREACT_DataObject_SetValueUnits(AQHREACT_DATAOBJECT *dataObject, const char *s);

uint64_t AQHREACT_DataObject_GetTimestamp(const AQHREACT_DATAOBJECT *dataObject);
void AQHREACT_DataObject_SetTimestamp(AQHREACT_DATAOBJECT *dataObject, uint64_t i);

int AQHREACT_DataObject_GetDataType(const AQHREACT_DATAOBJECT *dataObject);
void AQHREACT_DataObject_SetDataType(AQHREACT_DATAOBJECT *dataObject, int i);


double AQHREACT_DataObject_GetDoubleData(const AQHREACT_DATAOBJECT *dataObject);
void AQHREACT_DataObject_SetDoubleData(AQHREACT_DATAOBJECT *dataObject, double i);

const char *AQHREACT_DataObject_GetStringData(const AQHREACT_DATAOBJECT *dataObject);
void AQHREACT_DataObject_SetStringData(AQHREACT_DATAOBJECT *dataObject, const char *s);

int AQHREACT_DataObject_GetIntData(const AQHREACT_DATAOBJECT *dataObject);
void AQHREACT_DataObject_SetIntData(AQHREACT_DATAOBJECT *dataObject, int i);

void AQHREACT_DataObject_Dump(const AQHREACT_DATAOBJECT *dataObject, GWEN_BUFFER *buf, int indent);


const char *AQHREACT_DataObjectType_toString(int t);
int AQHREACT_DataObjectType_fromString(const char *s);


#endif

