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


#include "aqhome/api.h"

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



typedef struct AQH_EVENT_HANDLER AQH_EVENT_HANDLER;
GWEN_INHERIT_FUNCTION_LIB_DEFS(AQH_EVENT_HANDLER, AQHOME_API)
GWEN_LIST_FUNCTION_LIB_DEFS(AQH_EVENT_HANDLER, AQH_EventHandler, AQHOME_API)

#include "aqhome/events/eventtimer.h"
#include "aqhome/events/eventsubscription.h"



AQHOME_API AQH_EVENT_HANDLER *AQH_EventHandler_new();
AQHOME_API void AQH_EventHandler_free(AQH_EVENT_HANDLER *evh);

AQHOME_API AQH_EVENT_TIMER_LIST *AQH_EventHandler_GetTimerList(const AQH_EVENT_HANDLER *evh);
AQHOME_API void AQH_EventHandler_AddTimer(AQH_EVENT_HANDLER *evh, AQH_EVENT_TIMER *evt);

AQHOME_API AQH_EVENT_SUBSCRIPTION_LIST *AQH_EventHandler_GetSubscriptionList(const AQH_EVENT_HANDLER *evh);
AQHOME_API void AQH_EventHandler_AddSubscription(AQH_EVENT_HANDLER *evh, AQH_EVENT_SUBSCRIPTION *evs);


AQHOME_API void AQH_EventHandler_HandleTimeTick(AQH_EVENT_HANDLER *evh, uint64_t t);
AQHOME_API void AQH_EventHandler_HandleEvent(AQH_EVENT_HANDLER *evh, int eventType, uint64_t objectId, double data);



#endif


