#pragma once

#ifndef __INTELLISENSE__
#	define MODULE_EXPORT __attribute__( ( visibility( "default" ) ) )
#	define MODULE_WASM_MODNAME(mod) __attribute__((import_module(mod)))
#else
#	define MODULE_EXPORT
#	define MODULE_WASM_MODNAME(mod)
#	define __attribute__(x)
#	define __restrict__
#endif

/********************************* Headers *********************************/
// MSFS headers
#include <MSFS/MSFS.h>
#include <MSFS/MSFS_CommBus.h>
#include <MSFS/Legacy/gauges.h>
#include <rapidjson/document.h>
#include <rapidjson/filereadstream.h>
#include "rapidjson/filewritestream.h"
#include <rapidjson/writer.h>
#include <SimConnect.h>
// C headers
#include <string.h>
// C++ headers
#include <ctime>
// Own headers
#include "shared.h"
#include "pax.h"
#include "freighter.h"

/******************************** Constants ********************************/
// Module identification
#define MODULE_NAME "[KHOFMANN TFDi MD-11 Load Manager] "
#define VERSION_STRING "1.13"
// COMM BUS
#define COMM_BUS_LIVE_DATA_EVENT "khofmann_tfdi_md-11_load_manager_live_data"
#define COMM_BUS_UPDATE_TARGET_EVENT "khofmann_tfdi_md-11_load_manager_update_target"

/******************************** Functions ********************************/
void commBusUpdateTargetCallback(const char* args, unsigned int size, void* ctx);
int receiveData(const char* buf);
void sendData();
void CALLBACK MyDispatchProc(SIMCONNECT_RECV* pData, DWORD cbData, void* pContext);
void log(FILE* file, const char* format, void* optionalElement = NULL);
