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

bool DLLEXPORT simulation(char* uri, char* netName, char* flag)
{

    char fileName[256];
    char rptR[256];
    char outBinFile[256];

    strcpy_s(fileName, "test.inp");
    strcpy_s(rptR, "test.rpt");
    strcpy_s(outBinFile, "test.bin");

    CivHydrCalc* calc = new CivHydrCalc(uri, netName);
    CivSysLog::getInstance()->info("¿ªÊ¼", "interface", __FUNCTION__);
    bool msg = false;
    if (strcmp(flag,"HDY")==0)
        msg = calc->hydrSimulation( fileName, rptR, outBinFile);
    else if(strcmp(flag, "QUALITY")==0)
        msg = calc->qualitySimulation(fileName, rptR, outBinFile);

    if (msg)
    {
        CivSysLog::getInstance()->info("³É¹¦", "interface", __FUNCTION__);
    }       
    else
    {
        CivSysLog::getInstance()->info("Ê§°Ü", "interface", __FUNCTION__);
    }
    delete calc;
    return msg;
}


bool DLLEXPORT hdySimulation(char* uri, char* netName)
{
    return true;
}

bool DLLEXPORT qualitySimulation(char* uri, char* netName, char* type)
{
    return true;
}

bool DLLEXPORT qualityTrackingSimulation(char* uri, char* netName, char* nodeSn, char* time)
{


    return true;
}

bool DLLEXPORT getDataByInterval(char* uri, char* date, char* interval)
{

    CivHydrCalc* calc = new CivHydrCalc(uri, "");
    char inp[128];
    strcpy(inp, "test.inp");
    bool flag = calc->exportInp(inp);
    std::cout << flag << std::endl;
     //flag = calc->getDataByInterval(date, interval);
    delete calc;
    return flag;
}