// 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 PropertyFactory
	{
		public static Property Create()
		{
			return new Property(IntPtr.Zero);
		}
		public static void Destroy(Property obj)
		{
		}
	}
	/// <summary>
	/// This class implements a Property.
	/// </summary>
	public class Property {
#if __IOS__
		const string importLib = "__Internal";
#else
		const string importLib = "libVidyoClient";
#endif
		private IntPtr objPtr; // opaque VidyoProperty reference.
		public IntPtr GetObjectPtr() {
			IntPtr nName = MarshalPtrToUtf8.GetInstance().MarshalManagedToNative(name ?? string.Empty);
			IntPtr nValue = MarshalPtrToUtf8.GetInstance().MarshalManagedToNative(value ?? string.Empty);

			VidyoPropertySetnameNative(objPtr, nName);
			VidyoPropertySetvalueNative(objPtr, nValue);

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

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

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

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

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

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

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

		/// <summary>
		/// 
		/// </summary>
		public String name;
		/// <summary>
		/// 
		/// </summary>
		public String value;
		public Property(IntPtr obj){
			if(obj == IntPtr.Zero) {
				objPtr = VidyoPropertyConstructDefaultNative();
			}
			else {
				objPtr = VidyoPropertyConstructCopyNative(obj);
			}

			name = (string)MarshalPtrToUtf8.GetInstance().MarshalNativeToManaged(VidyoPropertyGetnameNative(objPtr));
			value = (string)MarshalPtrToUtf8.GetInstance().MarshalNativeToManaged(VidyoPropertyGetvalueNative(objPtr));
		}
		~Property() {
			VidyoPropertyDestructNative(objPtr);
		 }
	};
}
