// 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;

namespace VidyoClient
{
	public class EndpointPKG{
#if __IOS__
		const string importLib = "__Internal";
#else
		const string importLib = "libVidyoClient";
#endif

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

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

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

		[DllImport(importLib, CallingConvention = CallingConvention.Cdecl)]
		[return: MarshalAs(UnmanagedType.I1)]
		private static extern Boolean VidyoClientInitializeNative(IntPtr logFileName);

		[DllImport(importLib, CallingConvention = CallingConvention.Cdecl)]
		[return: MarshalAs(UnmanagedType.I1)]
		private static extern Boolean VidyoClientSetExperimentalOptionsNative(IntPtr options);

		[DllImport(importLib, CallingConvention = CallingConvention.Cdecl)]
		private static extern void VidyoClientUninitializeNative();

		public static String GetBuildTag(){

			IntPtr ret = VidyoClientGetBuildTagNative();

			return (string)MarshalPtrToUtf8.GetInstance().MarshalNativeToManaged(ret);
		}
		public static String GetVersion(){

			IntPtr ret = VidyoClientGetVersionNative();

			return (string)MarshalPtrToUtf8.GetInstance().MarshalNativeToManaged(ret);
		}
		public static String GetVersionWithoutBuildNumber(){

			IntPtr ret = VidyoClientGetVersionWithoutBuildNumberNative();

			return (string)MarshalPtrToUtf8.GetInstance().MarshalNativeToManaged(ret);
		}
		public static Boolean Initialize(String logFileName){

			IntPtr nLogFileName = MarshalPtrToUtf8.GetInstance().MarshalManagedToNative(logFileName ?? string.Empty);
			Boolean ret = VidyoClientInitializeNative(nLogFileName);
			Marshal.FreeHGlobal(nLogFileName);

			return ret;
		}
		public static Boolean SetExperimentalOptions(String options){

			IntPtr nOptions = MarshalPtrToUtf8.GetInstance().MarshalManagedToNative(options ?? string.Empty);
			Boolean ret = VidyoClientSetExperimentalOptionsNative(nOptions);
			Marshal.FreeHGlobal(nOptions);

			return ret;
		}
		public static void Uninitialize(){

			VidyoClientUninitializeNative();
		}
#if __ANDROID__
		internal static IntPtr javaClassHandle;
		internal static IntPtr javaClassRef;
		static IntPtr javaMethodRef;
		public static void SetApplicationUIContext(Android.Content.Context context)
		{
			javaClassRef = Android.Runtime.JNIEnv.FindClass("com/vidyo/VidyoClient/Endpoint/EndpointPkg", ref javaClassHandle);
			Android.Runtime.JNIEnv.ExceptionClear();
			javaMethodRef = Android.Runtime.JNIEnv.GetStaticMethodID(javaClassRef, "setApplicationUIContext", "(Landroid/content/Context;)V");
			Android.Runtime.JNIEnv.ExceptionClear();
			Android.Runtime.JNIEnv.CallStaticVoidMethod(javaClassRef, javaMethodRef, new Android.Runtime.JValue(context));
		}
#endif
	};
}
