/***************************************************************************
 *                                                                          *
 *  Copyright (C) Golaem S.A.  All Rights Reserved.                         *
 *                                                                          *
 ***************************************************************************/

#pragma once

#include <glmCrowdIOAPI.h>
#include <glmArray.h>
#include <glmString.h>
#include <stddef.h>
#include <sstream>

namespace glm
{
    namespace crowdio
    {
        extern GLM_CROWDIO_API void ADPConfigure(const char* productLineName, const char* productReleaseId, const char* productBuildId);
        extern GLM_CROWDIO_API void ADPIntialize();
        extern GLM_CROWDIO_API void ADPUnInitialize();

        extern GLM_CROWDIO_API void displayADPDialog(const char* inLocale, bool isActiveNotification = false, void* mainWindow = nullptr);

        extern GLM_CROWDIO_API void ADPUpdateLiFlow(int updateType); // 0: license flow start, 1: license flow end, 2: license not required
        extern GLM_CROWDIO_API void ADPHeartBeat(int heartBeatType); // 0: machine, 1: user
        extern GLM_CROWDIO_API void ADPReportCrash();

        extern GLM_CROWDIO_API void ADPTrackEvent(const char* componentName, const char* attributeName=NULL, const char* attributeValue=NULL);
        extern GLM_CROWDIO_API void ADPTrackEvent(const char* componentName, const Array<GlmString>& attributeNames, const Array<GlmString>& attributeValues);

        template <typename DataType>
        void ADPTrackEvent(const char* componentName, const char* attributeName, const DataType& attributeValue)
        {
            std::stringstream valueAsString;
            valueAsString << attributeValue;
            ADPTrackEvent(componentName, attributeName, valueAsString.str().c_str());
        }
    } // namespace crowd
} // namespace glm
