// 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 ConnectorTokenInfoFactory
	{
		public static ConnectorTokenInfo Create()
		{
			return new ConnectorTokenInfo(IntPtr.Zero);
		}
		public static void Destroy(ConnectorTokenInfo obj)
		{
		}
	}
	/// <summary>
	/// Represents the structure associate with token info.
	/// </summary>
	public class ConnectorTokenInfo {
#if __IOS__
		const string importLib = "__Internal";
#else
		const string importLib = "libVidyoClient";
#endif
		private IntPtr objPtr; // opaque VidyoConnectorTokenInfo reference.
		public IntPtr GetObjectPtr() {
			IntPtr nToken = MarshalPtrToUtf8.GetInstance().MarshalManagedToNative(token ?? string.Empty);

			VidyoConnectorTokenInfoSettokenNative(objPtr, nToken);
			VidyoConnectorTokenInfoSettokenTypeNative(objPtr, tokenType);

			Marshal.FreeHGlobal(nToken);
			return objPtr;
		}
		[DllImport(importLib, CallingConvention = CallingConvention.Cdecl)]
		private static extern IntPtr VidyoConnectorTokenInfoGettokenNative(IntPtr obj);

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

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

		[DllImport(importLib, CallingConvention = CallingConvention.Cdecl)]
		private static extern void VidyoConnectorTokenInfoSettokenTypeNative(IntPtr obj, Connector.ConnectorTokenType tokenType);

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

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

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

		/// <summary>
		/// Represents the value or data related to token.
		/// </summary>
		public String token;
		/// <summary>
		/// Represents the type of token, please refer VidyoConnectorTokenType.
		/// </summary>
		public Connector.ConnectorTokenType tokenType;
		public ConnectorTokenInfo(IntPtr obj){
			if(obj == IntPtr.Zero) {
				objPtr = VidyoConnectorTokenInfoConstructDefaultNative();
			}
			else {
				objPtr = VidyoConnectorTokenInfoConstructCopyNative(obj);
			}

			token = (string)MarshalPtrToUtf8.GetInstance().MarshalNativeToManaged(VidyoConnectorTokenInfoGettokenNative(objPtr));
			tokenType = VidyoConnectorTokenInfoGettokenTypeNative(objPtr);
		}
		~ConnectorTokenInfo() {
			VidyoConnectorTokenInfoDestructNative(objPtr);
		 }
	};
}
