#pragma once

#include "SettingInfo.hpp"

#include <stdexcept>

#pragma warning( push )
#pragma warning( disable : 4290 )

class CSettingInfoFactory {
public:

	class ErrorInfoListener {
	public:
		virtual ~ErrorInfoListener()  throw() {}

		virtual bool notifyErrorInfo(const tstring& v_errorInfo) throw() = 0;
	};

	class CSettingInfoFactoryException : public std::runtime_error {
	public:
		CSettingInfoFactoryException(const std::string& v_message)
			: std::runtime_error(v_message)
		{
		}
	};

	CSettingInfoFactory() throw();

	CSettingInfoFactory(const CSettingInfoFactory& v_other) throw();

	CSettingInfoFactory& operator=(const CSettingInfoFactory& v_other) throw();

	CSettingInfoFactory(const CSettingInfo& v_serringInfo) throw();

	virtual ~CSettingInfoFactory() throw();

	void setErrorInfoListener(ErrorInfoListener* v_pErrorInfoListener) throw();

	void setWatchDir(const tstring& v_watchDir) throw();

	void setWatchFile(const tstring& v_watchFile) throw();

	void setAction(const tstring& v_action) throw();

	void setAppName(const tstring& v_appName) throw();

	void setParam(const tstring& v_param) throw();

	void setLog(const tstring& v_log) throw();

	void setWaitWrite(const int v_waitWrite) throw();

	void setMaxProcess(const unsigned int v_nMaxProcess) throw();

	void setShowWindow(const ShowWindowType& v_nShowWindow) throw();

	void setTolerance(const int v_nTolerance) throw();

	void setDeletePending(const int v_nDeletePending) throw();

	void setMaxDepth(const int v_maxDepth) throw();

	void setForceInterval(const int v_forceInterval) throw();

	void setUsingDirNotificationAPI(const bool v_usingDirNotificationAPI) throw();

	void setDirNotificationAPIRetryInterval(const int v_dirNotificationAPIRetryInterval) throw();

	void setDirNotificationAPIExpirySpan(const int v_dirNotificationAPIExpirySpan) throw();

	void setLogLevel(const int v_logLevel) throw();

	void setAppCurrentDir(const tstring& v_appCurrentDir) throw();

	void setPersist(const tstring& v_persist) throw();

	void setArchiveOnly(const bool v_archiveOnly) throw();

	void setNotifyOnStart(const bool v_notifyOnStart) throw();

	void setWatchDelay(const int v_watchDelay) throw();

	void setIgnoreDuplicate(const bool v_ignoreDuplicate) throw();

	void setImpersonate(const bool v_impersonate) throw();

	void setImpersonateUser(const tstring& v_impersonateUser) throw();

	void setImpersonateDomain(const tstring& v_impersonateDomain) throw();

	void setImpersonatePassword(const tstring& v_impersonatePassword) throw();

	void setWatchDisabled(const bool v_watchDisabled) throw();

	bool validate(const bool v_silent = true) const throw();

	CSettingInfo create() const throw(CSettingInfoFactoryException);

protected:

	bool notifyErrorInfo(const tstring& v_errorInfo) const throw();

private:

	ErrorInfoListener* pErrorInfoListener_;

	CSettingInfo info_;
};

#pragma warning(pop)
