/****************************************************************************
 * This file is part of the project AqHome.
 * AqHome (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 AQHOME_SERVICE_H
#define AQHOME_SERVICE_H


#include <aqhome/api.h>

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


typedef struct AQH_SERVICE AQH_SERVICE;
GWEN_INHERIT_FUNCTION_LIB_DEFS(AQH_SERVICE, AQHOME_API);
GWEN_LIST_FUNCTION_LIB_DEFS(AQH_SERVICE, AQH_Service, AQHOME_API);


#include "aqhome/service/user.h"
#include "aqhome/service/module.h"
#include "aqhome/service/session.h"



AQHOME_API AQH_SERVICE *AQH_Service_new(void);
AQHOME_API void AQH_Service_free(AQH_SERVICE *sv);

AQHOME_API AQH_USER_LIST *AQH_Service_GetUserList(const AQH_SERVICE *sv);
AQHOME_API AQH_USER *AQH_Service_GetUserById(const AQH_SERVICE *sv, uint32_t id);
AQHOME_API AQH_USER *AQH_Service_GetUserByAlias(const AQH_SERVICE *sv, const char *s);
AQHOME_API void AQH_Service_AddUser(AQH_SERVICE *sv, AQH_USER *u);
AQHOME_API void AQH_Service_DelUser(AQH_SERVICE *sv, uint32_t userId);


AQHOME_API AQH_MODULE_LIST *AQH_Service_GetModuleList(const AQH_SERVICE *sv);
AQHOME_API AQH_MODULE *AQH_Service_GetModuleById(const AQH_SERVICE *sv, uint32_t id);
AQHOME_API AQH_MODULE *AQH_Service_GetModuleByName(const AQH_SERVICE *sv, const char *s);
AQHOME_API void AQH_Service_AddModule(AQH_SERVICE *sv, AQH_MODULE *m);
AQHOME_API void AQH_Service_DelModule(AQH_SERVICE *sv, uint32_t moduleId);

AQHOME_API AQH_SESSION_LIST *AQH_Service_GetSessionList(const AQH_SERVICE *sv);
AQHOME_API AQH_SESSION *AQH_Service_GetSessionByUid(const AQH_SERVICE *sv, const char *sessionUid);
AQHOME_API void AQH_Service_AddSession(AQH_SERVICE *sv, AQH_SESSION *session);
AQHOME_API void AQH_Service_DelSession(AQH_SERVICE *sv, const char *sid);



#endif
