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


#include "./aqhomestorage.h"



/* default values */
#define AQHOME_STORAGE_DEFAULT_PIDFILE           "/var/run/aqhome-storage.pid"
#define AQHOME_STORAGE_DEFAULT_IPC_PORT          45455
#define AQHOME_STORAGE_DEFAULT_HTTP_PORT         45456
#define AQHOME_STORAGE_DEFAULT_MQTT_CLIENTID     "AQHOMESTORAGE"
#define AQHOME_STORAGE_DEFAULT_MQTT_KEEPALIVE    600
#define AQHOME_STORAGE_DEFAULT_MQTT_PORT         1883

#define AQHOME_STORAGE_DEFAULT_CONFIGDIR         "/var/lib/aqhomestorage/config"
#define AQHOME_STORAGE_DEFAULT_HTTP_SOURCEDIR    "/var/lib/aqhomestorage/html"
#define AQHOME_STORAGE_DEFAULT_DATADIR           "/var/lib/aqhomestorage/data"

#define AQHOME_STORAGE_DEFAULT_STATEFILE         "/var/lib/aqhomestorage/config/statefile"

#define AQHOME_STORAGE_DEFAULT_MAXSESSIONAGE     (30*60)

#define AQHOME_STORAGE_SITEHEADER                "site-header.html"
#define AQHOME_STORAGE_SITEFOOTER                "site-footer.html"

#define AQHOME_STORAGE_STATIC_RELFOLDER          "static"


struct AQHOME_STORAGE {
  GWEN_MSG_ENDPOINT *rootEndpoint;

  GWEN_MSG_ENDPOINT *ipcdEndpoint;  /* don't release, will be released by freeing rootEndpoint! */
  GWEN_MSG_ENDPOINT *mqttEndpoint;  /* don't release, will be released by freeing rootEndpoint! */
  GWEN_MSG_ENDPOINT *httpdEndpoint; /* don't release, will be released by freeing rootEndpoint! */

  GWEN_DB_NODE *dbArgs;

  AQH_SERVICE *httpService;
  AQH_STORAGE *storage;

  char *pidFile;

  int maxSessionAgeInSeconds;

  int timeout;   /* timeout for run e.g. inside valgrind */
};

#endif

