//------------------------------------------------------------------------------
// <auto-generated />
//
// This file was automatically generated by SWIG (http://www.swig.org).
// Version 4.0.2
//
// Do not make changes to this file unless you know what you are doing--modify
// the SWIG interface file instead.
//------------------------------------------------------------------------------

namespace com.taptap.tapsdk.bindings.csharp {

public class Device : global::System.IDisposable {
  private global::System.Runtime.InteropServices.HandleRef swigCPtr;
  private bool swigCMemOwnBase;

  internal Device(global::System.IntPtr cPtr, bool cMemoryOwn) {
    swigCMemOwnBase = cMemoryOwn;
    swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
  }

  internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Device obj) {
    return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
  }

  ~Device() {
    Dispose(false);
  }

  public void Dispose() {
    Dispose(true);
    global::System.GC.SuppressFinalize(this);
  }

  protected virtual void Dispose(bool disposing) {
    lock(this) {
      if (swigCPtr.Handle != global::System.IntPtr.Zero) {
        if (swigCMemOwnBase) {
          swigCMemOwnBase = false;
          PlatformPINVOKE.delete_Device(swigCPtr);
        }
        swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
      }
    }
  }

  public static void SetCurrent(Device device) {
    PlatformPINVOKE.Device_SetCurrent(Device.getCPtr(device));
    if (PlatformPINVOKE.SWIGPendingException.Pending) throw PlatformPINVOKE.SWIGPendingException.Retrieve();
  }

  public static Device GetCurrent() {
    global::System.IntPtr cPtr = PlatformPINVOKE.Device_GetCurrent();
    Device ret = (cPtr == global::System.IntPtr.Zero) ? null : new Device(cPtr, true);
    return ret;
  }

  public virtual string GetDeviceID() {
    string ret = PlatformPINVOKE.Device_GetDeviceID(swigCPtr);
    if (PlatformPINVOKE.SWIGPendingException.Pending) throw PlatformPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public virtual string GetCacheDir() {
    string ret = PlatformPINVOKE.Device_GetCacheDir(swigCPtr);
    if (PlatformPINVOKE.SWIGPendingException.Pending) throw PlatformPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public virtual string GetCaCertDir() {
    string ret = PlatformPINVOKE.Device_GetCaCertDir(swigCPtr);
    if (PlatformPINVOKE.SWIGPendingException.Pending) throw PlatformPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public virtual DeviceType GetDeviceType() {
    DeviceType ret = (DeviceType)(SwigDerivedClassHasMethod("GetDeviceType", swigMethodTypes3) ? PlatformPINVOKE.Device_GetDeviceTypeSwigExplicitDevice(swigCPtr) : PlatformPINVOKE.Device_GetDeviceType(swigCPtr));
    if (PlatformPINVOKE.SWIGPendingException.Pending) throw PlatformPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public Device() : this(PlatformPINVOKE.new_Device(), true) {
    SwigDirectorConnect();
  }

  private void SwigDirectorConnect() {
    if (SwigDerivedClassHasMethod("GetDeviceID", swigMethodTypes0))
      swigDelegate0 = new SwigDelegateDevice_0(SwigDirectorMethodGetDeviceID);
    if (SwigDerivedClassHasMethod("GetCacheDir", swigMethodTypes1))
      swigDelegate1 = new SwigDelegateDevice_1(SwigDirectorMethodGetCacheDir);
    if (SwigDerivedClassHasMethod("GetCaCertDir", swigMethodTypes2))
      swigDelegate2 = new SwigDelegateDevice_2(SwigDirectorMethodGetCaCertDir);
    if (SwigDerivedClassHasMethod("GetDeviceType", swigMethodTypes3))
      swigDelegate3 = new SwigDelegateDevice_3(SwigDirectorMethodGetDeviceType);
    PlatformPINVOKE.Device_director_connect(swigCPtr, swigDelegate0, swigDelegate1, swigDelegate2, swigDelegate3);
  }

  private bool SwigDerivedClassHasMethod(string methodName, global::System.Type[] methodTypes) {
    global::System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance, null, methodTypes, null);
    bool hasDerivedMethod = methodInfo.DeclaringType.IsSubclassOf(typeof(Device));
    return hasDerivedMethod;
  }

  private string SwigDirectorMethodGetDeviceID() {
    return GetDeviceID();
  }

  private string SwigDirectorMethodGetCacheDir() {
    return GetCacheDir();
  }

  private string SwigDirectorMethodGetCaCertDir() {
    return GetCaCertDir();
  }

  private int SwigDirectorMethodGetDeviceType() {
    return (int)GetDeviceType();
  }

  public delegate string SwigDelegateDevice_0();
  public delegate string SwigDelegateDevice_1();
  public delegate string SwigDelegateDevice_2();
  public delegate int SwigDelegateDevice_3();

  private SwigDelegateDevice_0 swigDelegate0;
  private SwigDelegateDevice_1 swigDelegate1;
  private SwigDelegateDevice_2 swigDelegate2;
  private SwigDelegateDevice_3 swigDelegate3;

  private static global::System.Type[] swigMethodTypes0 = new global::System.Type[] {  };
  private static global::System.Type[] swigMethodTypes1 = new global::System.Type[] {  };
  private static global::System.Type[] swigMethodTypes2 = new global::System.Type[] {  };
  private static global::System.Type[] swigMethodTypes3 = new global::System.Type[] {  };
}

}
