/****************************************************************************
 * This file is part of the project Gwenhywfar.
 * Gwenhywfar (c) by 2023 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_EVENTSUBSCRIPTION_H
#define AQH_EVENTSUBSCRIPTION_H


#include "aqhome/api.h"

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



typedef struct AQH_EVENT_SUBSCRIPTION AQH_EVENT_SUBSCRIPTION;
GWEN_INHERIT_FUNCTION_LIB_DEFS(AQH_EVENT_SUBSCRIPTION, AQHOME_API)
GWEN_LIST_FUNCTION_LIB_DEFS(AQH_EVENT_SUBSCRIPTION, AQH_EventSubscription, AQHOME_API)

typedef int (*AQH_EVENT_SUBSCRIPTION_HANDLER_FN)(AQH_EVENT_SUBSCRIPTION *evs, int eventType, uint64_t objectId, double data);


AQHOME_API AQH_EVENT_SUBSCRIPTION *AQH_EventSubscription_new();
AQHOME_API void AQH_EventSubscription_free(AQH_EVENT_SUBSCRIPTION *evs);

AQHOME_API int AQH_EventSubscription_GetEventType(const AQH_EVENT_SUBSCRIPTION *evs);
AQHOME_API void AQH_EventSubscription_SetEventType(AQH_EVENT_SUBSCRIPTION *evs, int i);

AQHOME_API uint64_t AQH_EventSubscription_GetObjectId(const AQH_EVENT_SUBSCRIPTION *evs);
AQHOME_API void AQH_EventSubscription_SetObjectId(AQH_EVENT_SUBSCRIPTION *evs, uint64_t i);

AQHOME_API int AQH_EventSubscription_CallHandler(AQH_EVENT_SUBSCRIPTION *evs, int eventType, uint64_t objectId, double data);


#endif


