// DO NOT EDIT! This is an autogenerated file. All changes will be
// overwritten!

//	Copyright (c) 2023 Vidyo, Inc. All rights reserved.


using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;

namespace VidyoClient
{
	public class ConnectorInCallEventFactory
	{
		public static ConnectorInCallEvent Create()
		{
			return new ConnectorInCallEvent(IntPtr.Zero);
		}
		public static void Destroy(ConnectorInCallEvent obj)
		{
		}
	}
	/// <summary>
	/// It is the event which will be sent to application which register for incall events.
	/// </summary>
	public class ConnectorInCallEvent {
#if __IOS__
		const string importLib = "__Internal";
#else
		const string importLib = "libVidyoClient";
#endif
		private IntPtr objPtr; // opaque VidyoConnectorInCallEvent reference.
		public IntPtr GetObjectPtr() {
			IntPtr nDetails = MarshalPtrToUtf8.GetInstance().MarshalManagedToNative(details ?? string.Empty);

			VidyoConnectorInCallEventSetcodeNative(objPtr, code);
			VidyoConnectorInCallEventSetdetailsNative(objPtr, nDetails);
			VidyoConnectorInCallEventSettypeNative(objPtr, type);

			Marshal.FreeHGlobal(nDetails);
			return objPtr;
		}
		[DllImport(importLib, CallingConvention = CallingConvention.Cdecl)]
		[return: MarshalAs(UnmanagedType.I4)]
		private static extern Connector.ConnectorInCallEventCode VidyoConnectorInCallEventGetcodeNative(IntPtr obj);

		[DllImport(importLib, CallingConvention = CallingConvention.Cdecl)]
		private static extern void VidyoConnectorInCallEventSetcodeNative(IntPtr obj, Connector.ConnectorInCallEventCode code);

		[DllImport(importLib, CallingConvention = CallingConvention.Cdecl)]
		private static extern IntPtr VidyoConnectorInCallEventGetdetailsNative(IntPtr obj);

		[DllImport(importLib, CallingConvention = CallingConvention.Cdecl)]
		private static extern void VidyoConnectorInCallEventSetdetailsNative(IntPtr obj, IntPtr details);

		[DllImport(importLib, CallingConvention = CallingConvention.Cdecl)]
		[return: MarshalAs(UnmanagedType.I4)]
		private static extern Connector.ConnectorInCallEventClass VidyoConnectorInCallEventGettypeNative(IntPtr obj);

		[DllImport(importLib, CallingConvention = CallingConvention.Cdecl)]
		private static extern void VidyoConnectorInCallEventSettypeNative(IntPtr obj, Connector.ConnectorInCallEventClass type);

		[DllImport(importLib, CallingConvention = CallingConvention.Cdecl)]
		public static extern IntPtr VidyoConnectorInCallEventConstructCopyNative(IntPtr obj);

		[DllImport(importLib, CallingConvention = CallingConvention.Cdecl)]
		public static extern IntPtr VidyoConnectorInCallEventConstructDefaultNative();

		[DllImport(importLib, CallingConvention = CallingConvention.Cdecl)]
		public static extern void VidyoConnectorInCallEventDestructNative(IntPtr obj);

		/// <summary>
		/// It is error code for the event.
		/// </summary>
		public Connector.ConnectorInCallEventCode code;
		/// <summary>
		/// It extra information for the event. It is optional and it may depend on type of event.
		/// </summary>
		public String details;
		/// <summary>
		/// This indicate the module to which event belongs to.
		/// </summary>
		public Connector.ConnectorInCallEventClass type;
		public ConnectorInCallEvent(IntPtr obj){
			if(obj == IntPtr.Zero) {
				objPtr = VidyoConnectorInCallEventConstructDefaultNative();
			}
			else {
				objPtr = VidyoConnectorInCallEventConstructCopyNative(obj);
			}

			code = VidyoConnectorInCallEventGetcodeNative(objPtr);
			details = (string)MarshalPtrToUtf8.GetInstance().MarshalNativeToManaged(VidyoConnectorInCallEventGetdetailsNative(objPtr));
			type = VidyoConnectorInCallEventGettypeNative(objPtr);
		}
		~ConnectorInCallEvent() {
			VidyoConnectorInCallEventDestructNative(objPtr);
		 }
	};
}
