// trigobjs.idl : IDL source for MSMQTriggerObjects.dll
//

// This file will be processed by the MIDL tool to
// produce the type library (trigobjs.tlb) and marshalling code.

import "oaidl.idl";
import "ocidl.idl";


[
	uuid(1D9F85B1-9666-11D2-8927-0008C70C0622),
	version(1.0),
	helpstring("MSMQTriggerObjects 1.0 Type Library"),
	hidden
]
library MSMQTriggerObjects
{
	importlib("stdole32.tlb");
	importlib("stdole2.tlb");

	typedef [v1_enum, hidden] enum 
	{
		RULES_PROCESSING_CONTINUE = 0,
		RULES_PROCESSING_STOP
	}RulesProcessingStatus;

	typedef [v1_enum, hidden] enum 
	{
		SYSTEM_QUEUE_NONE = 0,
		SYSTEM_QUEUE_JOURNAL,	
		SYSTEM_QUEUE_DEADLETTER,
		SYSTEM_QUEUE_DEADXACT,
	}SystemQueueIdentifier;

	typedef [v1_enum, hidden] enum 
	{
		PEEK_MESSAGE = 0,
		RECEIVE_MESSAGE,	
		RECEIVE_MESSAGE_XACT,
	} MsgProcessingType;

	[
		uuid(1D9F85C1-9666-11D2-8927-0008C70C0622),
		helpstring("_IMSMQTriggerSetEvents Interface"),
		hidden
	]
	dispinterface _IMSMQTriggerSetEvents
	{
		properties:
		methods:
	};

	//*********************************************************************************
	//
	// Interface   : IMSMQPropertyBag
	//
	// Description : This is the interface to the MSMQPropertyBag object. It is used 
	//               to store named variants.
	//
	//*********************************************************************************
	[
		object,
		uuid(07F19951-AB28-11D2-8936-000000000000),
		dual,
		helpstring("IMSMQPropertyBag Interface"),
		pointer_default(unique),
		hidden
	]
	interface IMSMQPropertyBag : IDispatch
	{
		[id(1), helpstring("method Write")] HRESULT Write([in] BSTR sPropertyName,  [in] VARIANT vPropertyValue);
		[id(2), helpstring("method Read")] HRESULT Read([in] BSTR sPropertyName , [out] VARIANT * pvPropertyValue);

		[propget, id(3), helpstring("property Count")] HRESULT Count([out, retval] long *pVal);
	};


	//*********************************************************************************
	//
	// Interface   : IMSMQRuleHandler
	//
	// Description : This is the interface to the MSMQRuleHandler object. This is the 
	//               MS supplied default rule handler that will be used by the 
	//               trigger service.
	//
	//*********************************************************************************
	[
		object,
		uuid(B0CDBF11-9774-11D2-8929-000000000000),
		dual,
		helpstring("IMSMQRuleHandler Interface"),
		pointer_default(unique),
		hidden
	]
	interface IMSMQRuleHandler : IDispatch
	{
	
		[id(1), helpstring("method Init")] HRESULT Init([in] BSTR bstrRuleID, [in] BSTR sRuleCondition , [in] BSTR sRuleAction, [in] BOOL fShowWindow );
		[id(2), helpstring("method CheckRuleCondition")] HRESULT CheckRuleCondition([in] IMSMQPropertyBag * pIPropertyBag ,  [out] BOOL * pbConditionSatisfied );
		[id(3), helpstring("method ExecuteRule")] HRESULT ExecuteRule([in] IMSMQPropertyBag * pIPropertyBag , [in] BOOL fIsSerializedQueue,  [out] LONG * plRuleResult );

	};

	//*********************************************************************************
	//
	// Interface   : _IMSMQRuleHandlerEvents
	//
	// Description : This is the events interface to the MSMQRuleHandler object. At 
	//               present this object does not have any events, so this interface 
	//               is simply a placeholder.
	//
	//*********************************************************************************
	[
		uuid(B0CDBF13-9774-11D2-8929-000000000000),
		helpstring("_IMSMQRuleHandlerEvents Interface"),
		hidden
	]
	dispinterface _IMSMQRuleHandlerEvents
	{
		properties:
		methods:
	};


	//*********************************************************************************
	//
	// Interface   : IMSMQTriggerSet
	//
	// Description : This is the interface to the MSMQTriggerSet object. This is the 
	//               main object that is used to manipulate trigger definitions in the 
	//               trigger store. It contains method for manipulating triggers based 
	//               on their id - as well as by an index in the MSMQTriggerSet objects'
	//               cache. 
    //
	//*********************************************************************************
	[
		object,
		uuid(1D9F85BF-9666-11D2-8927-0008C70C0622),
		dual,
		helpstring("IMSMQTriggerSet Interface"),
		pointer_default(unique),
		hidden
	]
	interface IMSMQTriggerSet : IDispatch
	{
		
		[id(1), helpstring("method Refresh")] 
		        HRESULT Refresh();

		[id(2), helpstring("method AddTrigger")]				
		        HRESULT AddTrigger([in] BSTR sTriggerName,
		                           [in] BSTR sQueueName,
								   [in] SystemQueueIdentifier SystemQueue, 
								   [in] long lEnabled,
								   [in] long lSerialized,
								   [in] MsgProcessingType msgProcType,
								   [out] BSTR * psTriggerID);

		[id(3), helpstring("method DeleteTrigger")] 		  
		        HRESULT DeleteTrigger([in] BSTR sTriggerID);

		[id(4), helpstring("method GetTriggerDetailsByID")] 		  
		        HRESULT GetTriggerDetailsByID([in] BSTR  sTriggerID,
		                                      [out] BSTR * psTriggerName,
											  [out] BSTR * psQueueName,
											  [out] SystemQueueIdentifier* pSystemQueue, 
											  [out] long * plNumberOfRules, 
											  [out] long * plEnabledStatus,
											  [out] long * plSerialized,
											  [out] MsgProcessingType * pMsgProcType);


		[id(5), helpstring("method GetTriggerDetailsByIndex")] 
		        HRESULT GetTriggerDetailsByIndex([in] long lTriggerIndex , 
				                                 [out] BSTR * psTriggerID , 
												 [out] BSTR * psTriggerName , 
												 [out] BSTR * psQueueName,
												 [out] SystemQueueIdentifier* pSystemQueue, 
												 [out] long * plNumberOfRules, 
												 [out] long * plEnabledStatus,
												 [out] long * plSerialized,
												 [out] MsgProcessingType * pMsgProcType);

		[id(6), helpstring("method GetRuleDetailsByTriggerID")] 
		        HRESULT GetRuleDetailsByTriggerID([in] BSTR sTriggerID, 
				                                  [in] long lRuleIndex, 
												  [out] BSTR * psRuleID, 
												  [out] BSTR * psRuleName, 
												  [out] BSTR * psDescription, 
												  [out] BSTR * psCondition ,
												  [out] BSTR * psAction , 
												  [out] BSTR * psImplementationProgID, 
												  [out] BOOL * pfShowWindow);//,
												  //[out] long * plRefCount );

		[id(7), helpstring("method GetRuleDetailsByTriggerIndex")] 
		        HRESULT GetRuleDetailsByTriggerIndex([in] long lTriggerIndex, 
				                                     [in] long lRuleIndex, 
													 [out] BSTR * psRuleID, 
													 [out] BSTR * psRuleName, 
													 [out] BSTR * psDescription, 
													 [out] BSTR * psCondition , 
													 [out] BSTR * psAction , 
													 [out] BSTR * psImplementationProgID, 
													 [out] BOOL * pfShowWindow);//,
													 //[out] long * plRefCount );

		//[id(8), helpstring("method GetTrigger")] HRESULT GetTrigger([in] BSTR * psTriggerID , [out, retval] IMSMQTrigger ** ppIMSMQTrigger);

		[propget, id(9), helpstring("property Count")] 
			                 HRESULT Count([out, retval] long *pVal);

		[id(10), helpstring("method UpdateTrigger")] 
		         HRESULT UpdateTrigger([in] BSTR sTriggerID, 
				                       [in] BSTR sTriggerName , 
									   [in] BSTR sQueueName, 
									   [in] SystemQueueIdentifier SystemQueue, 
									   [in] long lEnabled , 
									   [in] long lSerialized,
									   [in] MsgProcessingType msgProcType);

		[id(11), helpstring("method DetachAllRules")] 
		         HRESULT DetachAllRules([in] BSTR sTriggerID);

		[id(12), helpstring("method AttachRule")] 
		         HRESULT AttachRule([in] BSTR sTriggerID ,
				                    [in] BSTR sRuleID , 
									[in] long lPriority); 

		[id(13), helpstring("method DetachRule")] 
		         HRESULT DetachRule([in] BSTR sTriggerID , 
				                    [in] BSTR sRuleID);
		[id(14), helpstring("method Init")] HRESULT Init([in] BSTR bstrMachineName);
		[propget, id(15), helpstring("property TriggerStoreMachineName")] HRESULT TriggerStoreMachineName([out, retval] BSTR *pVal);
	};


	//*********************************************************************************
	//
	// Interface   : IMSMQRuleSet
	//
	// Description : This is the interface to the MSMQRuleSet object. This is the 
	//               main object that is used to manipulate rule definitions in the 
	//               trigger store. It contains method for manipulating rules based 
	//               on their id - as well as by an index in the MSMQRuleSet objects'
	//               cache. 
    //
	//*********************************************************************************
	[
		object,
		uuid(65221283-B64E-11D2-894C-0008C70C0622),
		dual,
		helpstring("IMSMQRuleSet Interface"),
		pointer_default(unique),
		hidden
	]
	interface IMSMQRuleSet : IDispatch
	{
		[id(1), helpstring("Refreshes the Ruleset object with rule information from the trigger data store")] 
		HRESULT Refresh();

		[propget, id(2), helpstring("property Count")] 
		HRESULT Count([out, retval] long *pVal);

		[id(3), helpstring("method GetRuleDetailsByID")] 
		HRESULT GetRuleDetailsByID([in] BSTR sRuleID,
		                           [out] BSTR * psRuleName, 
								   [out] BSTR * psDescription,
								   [out] BSTR * psCondition, 
								   [out] BSTR * psAction, 
								   [out] BSTR * psImplementationProgID,
								   [out] BOOL* pfShowWindow);//,
								   //[out] long * plRefCount );

		[id(4), helpstring("method GetRuleDetailsByIndex")] 
		HRESULT GetRuleDetailsByIndex([in] long lRuleIndex, 
		                              [out] BSTR * psRuleID, 
									  [out] BSTR * psRuleName, 
									  [out] BSTR * psDescription, 
									  [out] BSTR * psCondition, 
									  [out] BSTR * psAction, 
									  [out] BSTR * psImplementationProgID,
									  [out] BOOL* pfShowWindow);//,
									  //[out] long * plRefCount );

		[id(5), helpstring("method Delete")] 
		HRESULT Delete([in] BSTR sRuleID);

		[id(6), helpstring("method Add")] 
		HRESULT Add([in] BSTR sName, 
		            [in] BSTR sDescription , 
					[in] BSTR sCondition , 
					[in] BSTR sAction , 
					[in] BSTR sImplementation, 
					[in] BOOL fShowWindow,
					[out] BSTR * psRuleID );

		[id(7), helpstring("method Update")] 
		HRESULT Update([in] BSTR sRuleID ,
		               [in] BSTR sName , 
					   [in] BSTR sDescription , 
					   [in] BSTR sCondition , 
					   [in] BSTR sAction , 
					   [in] BSTR sImplementation,
					   [in] BOOL fShowWindow );
		[id(8), helpstring("method Init")] HRESULT Init([in] BSTR bstrMachineName);
		[propget, id(9), helpstring("property TriggerStoreMachineName")] HRESULT TriggerStoreMachineName([out, retval] BSTR *pVal);

	};


	//*********************************************************************************
	//
	// Interface   : IMSMQTriggersConfig
	//
	// Description : This is the interface used to store and collect configuration 
	//               parameters for the MSMQ Triggers feature.
    //
	//*********************************************************************************
	[
		object,
		uuid(7C55D6A1-F584-11D2-89B2-000000000000),
		dual,
		helpstring("IMSMQTriggersConfig Interface"),
		pointer_default(unique),
		hidden
	]
	interface IMSMQTriggersConfig : IDispatch
	{
		[propget, id(1), helpstring("property TriggerStoreMachineName")] HRESULT TriggerStoreMachineName([out, retval] BSTR *pVal);

		[propget, id(2), helpstring("property InitialThreads")] HRESULT InitialThreads([out, retval] long *pVal);
		[propput, id(2), helpstring("property InitialThreads")] HRESULT InitialThreads([in] long newVal);

		[propget, id(3), helpstring("property MaxThreads")] HRESULT MaxThreads([out, retval] long *pVal);
		[propput, id(3), helpstring("property MaxThreads")] HRESULT MaxThreads([in] long newVal);

		[propget, id(4), helpstring("property NotificationsQueueName")] HRESULT NotificationsQueueName([out, retval] BSTR *pVal);

		[propget, id(5), helpstring("property DefaultMsgBodySize")] HRESULT DefaultMsgBodySize([out, retval] long *plMsgBodySize);
		[propput, id(5), helpstring("property DefaultMsgBodySize")] HRESULT DefaultMsgBodySize([in] long lMsgBodySize);

		[propget, id(6), helpstring("property InitTimeout")] HRESULT InitTimeout([out, retval] long *pVal);
		[propput, id(6), helpstring("property InitTimeout")] HRESULT InitTimeout([in] long newVal);
	};

	
	// **********************************************************************************
    // Coclass definitions - defining which object support which interfaces.
	// **********************************************************************************
	[
		uuid(1D9F85C0-9666-11D2-8927-0008C70C0622),
		helpstring("MSMQTriggerSet Class"),
		hidden
	]
	coclass MSMQTriggerSet
	{
		[default] interface IMSMQTriggerSet;
		[default, source] dispinterface _IMSMQTriggerSetEvents;
	};

	[
		uuid(B0CDBF12-9774-11D2-8929-000000000000),
		helpstring("MSMQRuleHandler Class"),
		hidden
	]
	coclass MSMQRuleHandler
	{
		[default] interface IMSMQRuleHandler;
		[default, source] dispinterface _IMSMQRuleHandlerEvents;
	};
	[
		uuid(07F19952-AB28-11D2-8936-000000000000),
		helpstring("IMSMQPropertyBag Class"),
		hidden
	]
	coclass MSMQPropertyBag
	{
		[default] interface IMSMQPropertyBag;
	};
	[
		uuid(65221284-B64E-11D2-894C-0008C70C0622),
		helpstring("MSMQRuleSet Class"),
		hidden
	]
	coclass MSMQRuleSet
	{
		[default] interface IMSMQRuleSet;
	};

	//
	// Trigger object has been 'phased out'.
	//
	//[
	//	uuid(65221286-B64E-11D2-894C-0008C70C0622),
	//	helpstring("MSMQTrigger Class")
	//]
	//coclass MSMQTrigger
	//{
	//	[default] interface IMSMQTrigger;
	//};
	[
		uuid(7C55D6A2-F584-11D2-89B2-000000000000),
		helpstring("MSMQTriggersConfig Class"),
		hidden
	]
	coclass MSMQTriggersConfig
	{
		[default] interface IMSMQTriggersConfig;
	};
};
