#pragma once
#include "epanet2.h"
#include "CivSimulResultCache.h"

/**
  水力计算类
*/
class CivHydrCompute
{
public:
	explicit CivHydrCompute();

	/**
	 *@brief 水质计算
	 */
	bool qualityCompute();

	bool chlorineCompute();
	/**
	 *@brief 水力计算
	 */
	bool hdyrCompute();

	/**
	 *@brief 将计算结果保存到数据库
	 *@param uri 数据库连接地址
	 */
	void saveResult(const std::string& uri);
	void cacheCodeSn(const std::string& uri);

	void getTrackingResult(const std::string& uri,std::string& jsonResult);

	void getNodeItemByInterval(int time, NodeResultItems& nodeItem);
	void getPipeItemByInterval(int time, LinkResultItems& linkItem);

private:
	void getNodeResult(short time);
	void getLinkResult(short time);
	void getNodeQuality(short time);
	void getLinkQuality(short time);
	void getNodeChlorine(short time);
	void getLinkChlorine(short time);
	void dateAndTime(int time, std::string& date, std::string& nowtime);

	CivSimulResultCache mResultCache;

	std::string mInFile;
	std::string mRptFile;
	std::string mBinFile;
};
