#include "CivHydrFuncInter.h"
#include "CivSysLog.h"

#include "CivHydrSimulation.h"
#include "CivTrackingAnalysis.h"

bool FUNEXPORT hdyrSimulation(char* uri)
{
    CivHydrSimulation simulation(uri);
    return simulation.hdyrSimulation();
}

bool FUNEXPORT qualitySimulation(char* uri)
{
    CivHydrSimulation simulation(uri);
    return simulation.qualitySimulation();
}

bool FUNEXPORT trackingSimulation(char* uri, char* sN, int hours, char* result)
{
    CivHydrSimulation simulation(uri);

    std::string res;
    if (!simulation.trackingSimulation(sN, hours, res))
        return false;

    strcpy(result, res.c_str());

    return  true;
}

bool FUNEXPORT upstreamTracking(char* uri, char* sn, char* result)
{
    CivTrackingAnalysis track(uri);
    track.createGraphFrom();

    std::string jsonResult;
    if (!track.upstreamTracking(sn, jsonResult))
        return false;

    strcpy(result, jsonResult.c_str());

    return true;
}

bool FUNEXPORT downstreamTracking(char* uri, char* sn, char* result)
{
    CivTrackingAnalysis track(uri);
    track.createGraphFrom();

    std::string jsonResult;
    if (!track.downstreamTracking(sn, jsonResult))
        return false;

    strcpy(result, jsonResult.c_str());
    return true;
}

bool FUNEXPORT waterSupplyScopeAnalysis(char* uri, char* sn, char* result)
{
    
    return true;
}

bool FUNEXPORT projSimulation(char* uri, char* projCode, char* time)
{
    return true;
}