#pragma once
#include "IntPropertyInternal.h"
#include "EventPropertyInternal.h"
#include "GroupPropertyInternal.h"
#include "SIShadowPropertyInternal.h"



namespace NDTS
{
	using namespace SCO;

namespace RS2A
{
	class TCGInternal;
	class RS2A_API SDKChangeHook : public GroupHooks
	{
	public:
		SDKChangeHook(void);
		virtual ~SDKChangeHook(void);

		// Called during an IntPropertyInternal setValue before the value is sent to the SDK 
		// return false if it is not currently OK to set the property, e.g. if scanning
		virtual bool isOkToSet(PropertyInternal *pProperty);
		// Called once the property has been set in the SDK.  E.g. if the rep rate has been changed,
		// update the max of the range.
		// Returns true if there have been no errors or property changes
		virtual void postSetUpdate(IntPropertyInternal *pProp);
		virtual void postEventUpdate(EventPropertyInternal *pProp);
		// Called after the app has called commitGroup() but before any properties changed in the commit have been applied
		// used to set certain values so that the commit won't fail, e.g. set the A Scan range to a small value.
		virtual void preCommit();

		void setTcg(TCGInternal *pTcg);


	private:

		// Functions called during the post set hook
		void configureArray();
		void updateRangeDelayRepMax();
		void configureTriggering();
		void configureStandAloneRQ();
		void setNotCurrentlyValid(Property *pProp, bool isNotCurrentlyValid);

		// The properties that we need to know about which are set in SDKPropertiesCollection
		friend class SDKPropertiesCollection;
		TCGInternal *pTcg;

		bool postSetUpdateDisabled;

		IntPropertyInternal *pIsScanningProp;
		IntPropertyInternal *pScanTriggerModeProp;
		IntPropertyInternal *pIsExtTriggerProp;
				
		IntPropertyInternal *pAScanRangeProp;
		IntPropertyInternal *pAScanRepRateProp;
		IntPropertyInternal *pBScanRepRateSamplesProp;
		SIShadowPropertyInternal *pBScanRepRateSIProp;
		IntPropertyInternal *pSampleFreqProp;
		IntPropertyInternal *pAScanDelayProp;
		IntPropertyInternal *pSamplesDropProp;

		IntPropertyInternal *pNumberOfElementsProp;
		IntPropertyInternal *pApertureSizeProp;
		IntPropertyInternal *pInvertArrayProp;
		IntPropertyInternal *pPingPongProp;
		IntPropertyInternal *pElementMultiplierProp;
		IntPropertyInternal *pAScansPerBScanProp;

		IntPropertyInternal *pEncoderToTriggerOffProp;

		EventPropertyInternal *pTakeSnapshotProp;

		IntPropertyInternal *pIsStandAloneRQProp;

	};
}}