/****************************************************************************
 * 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 AQHOME_REACT_H
#define AQHOME_REACT_H

#include <gwenhywfar/endpoint.h>


typedef struct AQHOME_REACT AQHOME_REACT;

#include "aqhome-react/types/unit.h"


AQHOME_REACT *AqHomeReact_new();
void AqHomeReact_free(AQHOME_REACT *aqh);

GWEN_MSG_ENDPOINT *AqHomeReact_GetBrokerEndpoint(const AQHOME_REACT *aqh);

GWEN_DB_NODE *AqHomeReact_GetDbArgs(const AQHOME_REACT *aqh);

const char *AqHomeReact_GetPidFile(const AQHOME_REACT *aqh);
void AqHomeReact_SetPidFile(AQHOME_REACT *aqh, const char *s);

int AqHomeReact_GetTimeout(const AQHOME_REACT *aqh);

time_t AqHomeReact_GetLatestNetworkFileTime(const AQHOME_REACT *aqh);
void AqHomeReact_SetLatestNetworkFileTime(AQHOME_REACT *aqh, time_t t);


AQHREACT_UNIT *AqHomeReact_GetTimerUnit(const AQHOME_REACT *aqh);
AQHREACT_UNIT *AqHomeReact_GetVarChangeUnit(const AQHOME_REACT *aqh);

AQHREACT_UNIT *AqHomeReact_FindUnitByUnitId(const AQHOME_REACT *aqh, const char *unitId);
void AqHomeReact_AddUnit(AQHOME_REACT *aqh, AQHREACT_UNIT *unit);

AQHREACT_UNIT *AqHomeReact_CreateUnitByName(AQHOME_REACT *aqh, const char *unitType);


#endif

