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


#include "aqhome/service/service.h"
#include "aqhome/data/storage.h"
#include "aqhome/http/content.h"

#include <gwenhywfar/endpoint.h>


#define AQHOME_HTTP_PERMS_LIST_ROOMS    0x00000001
#define AQHOME_HTTP_PERMS_LIST_DEVICES  0x00000002
#define AQHOME_HTTP_PERMS_LIST_VALUES   0x00000004
#define AQHOME_HTTP_PERMS_LIST_TOPICS   0x00000008

#define AQHOME_HTTP_PERMS_ADD_ROOM      0x00000100
#define AQHOME_HTTP_PERMS_ADD_DEVICE    0x00000200
#define AQHOME_HTTP_PERMS_ADD_VALUE     0x00000400
#define AQHOME_HTTP_PERMS_ADD_TOPIC     0x00000800

#define AQHOME_HTTP_PERMS_DEL_ROOM      0x00010000
#define AQHOME_HTTP_PERMS_DEL_DEVICE    0x00020000
#define AQHOME_HTTP_PERMS_DEL_VALUE     0x00040000
#define AQHOME_HTTP_PERMS_DEL_TOPIC     0x00080000

#define AQHOME_HTTP_PERMS_EDIT_ROOM     0x01000000
#define AQHOME_HTTP_PERMS_EDIT_DEVICE   0x02000000
#define AQHOME_HTTP_PERMS_EDIT_VALUE    0x04000000
#define AQHOME_HTTP_PERMS_EDIT_TOPIC    0x08000000





void AqHomeHttpService_Extend(AQH_SERVICE *sv);

AQH_STORAGE *AqHomeHttpService_GetStorage(const AQH_SERVICE *sv);
void AqHomeHttpService_SetStorage(AQH_SERVICE *sv, AQH_STORAGE *sto);

AQH_HTTP_CONTENT *AqHomeHttpService_GetContentTree(const AQH_SERVICE *sv);
void AqHomeHttpService_SetContentTree(AQH_SERVICE *sv, AQH_HTTP_CONTENT *c);


int AqHomeHttpService_LockStorage(AQH_SERVICE *sv);
int AqHomeHttpService_UnlockStorage(AQH_SERVICE *sv);
void AqHomeHttpService_MarkStorageChanged(AQH_SERVICE *sv);

#endif


