#ifndef _CIVINPEXPOTER_H
#define _CIVINPEXPOTER_H
#include "CivNewInp.h"
#include "CivInpHelperAbs.h"
#include "pandaAnalysis.h"

#define ASSERT(A,B)  if ((A) == nullptr || (B) == nullptr) return
/**
* 抽象建造者
*/
class CivInpBuilder
{
public:
	explicit CivInpBuilder(const std::string& uri);
	virtual ~CivInpBuilder();

	/**
	 *@brief 设置选择项值
	 */
	void setOption(const std::string& name, const std::string& val);
	
	/**
	 *@brief 设置模拟时间选项
	 */
	void setTimes(const std::string& name, const std::string& val);

	/**
	*@brief 是否延时模拟
	*/
	void isDelayTimeSmuli(bool isDelay);

	/**
	 *@brief 设置输出报告选项
	 */
	void setReport(const std::string& name, const std::string& val);

	/**
	 *@brief 设置反应系数选项
	 */
	void setReaction(const std::string& name, const std::string& val);

	void setQuality(const std::string& name, const std::string& val);
	void setQualityType(CivInpHelperAbs::QualityType type);

	void  resetAllToZero() { mResetToZero = true; }
	void  setPatternTime(const std::string& patternTime);
	
	/**
	 *@brief 返回装成的inp文件名
	 */
	bool getNewInp(std::string& infile);
	void buildParamter();

	virtual void buildCurves();
	virtual void buildTags();
	virtual void buildBackDrop();
	virtual void buildLabels();
	virtual void buildVertices();

	// 预处理，阀门，水泵等类管段类型的组件
	virtual void preHandleLikelyPipe() = 0;
	virtual void buildNode()=0;
	virtual void buildPipe()=0;
	virtual void buildTank()=0;
	virtual void buildVavle()=0;
	virtual void buildPump()=0;
	virtual void buildReservoir()=0;
	virtual void buildEmitter()=0;
	virtual void buildPatterns()=0;	
	virtual void buildCoordnates()=0;
	virtual void buildQuality()=0;
	virtual void buildSources()=0;
	virtual void buildMixing()=0;
	virtual void buildStatus()=0;
	virtual void buildControls()=0;
	virtual void buildRules()=0;
	virtual void buildDemands()=0;
protected:
	CivParameter mOptions;
	CivParameter mTimes;
	CivParameter mReactions;
	CivParameter mReport;
	CivQuality mInitQuality; // 节点的初始水质

	CivNewInp* mNewInp;
	CivInpHelperAbs* mHelper;

	std::string mPattenTime;

	bool mResetToZero = false;

	std::string mUri;
};

#endif // !_CIVINPEXPOTER_H



