// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.

namespace Gst.WebRTC {

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

#region Autogenerated code
	[StructLayout(LayoutKind.Sequential)]
	public partial struct WebRTCSessionDescription : IEquatable<WebRTCSessionDescription> {

		public Gst.WebRTC.WebRTCSDPType Type;
		private IntPtr _sdp;
		public Gst.Sdp.SDPMessage Sdp {
			get {
				return _sdp == IntPtr.Zero ? null : (Gst.Sdp.SDPMessage) GLib.Opaque.GetOpaque (_sdp, typeof (Gst.Sdp.SDPMessage), false);
			}
			set {
				_sdp = value == null ? IntPtr.Zero : value.Handle;
			}
		}

		public static Gst.WebRTC.WebRTCSessionDescription Zero = new Gst.WebRTC.WebRTCSessionDescription ();

		public static Gst.WebRTC.WebRTCSessionDescription New(IntPtr raw) {
			if (raw == IntPtr.Zero)
				return Gst.WebRTC.WebRTCSessionDescription.Zero;
			return (Gst.WebRTC.WebRTCSessionDescription) Marshal.PtrToStructure (raw, typeof (Gst.WebRTC.WebRTCSessionDescription));
		}

		[DllImport("gstwebrtc-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_webrtc_session_description_new(int type, IntPtr sdp);

		public static WebRTCSessionDescription New(Gst.WebRTC.WebRTCSDPType type, Gst.Sdp.SDPMessage sdp)
		{
			sdp.Owned = false;
			WebRTCSessionDescription result = WebRTCSessionDescription.New (gst_webrtc_session_description_new((int) type, sdp == null ? IntPtr.Zero : sdp.Handle));
			return result;
		}

		[DllImport("gstwebrtc-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_webrtc_session_description_get_type();

		public static GLib.GType GType { 
			get {
				IntPtr raw_ret = gst_webrtc_session_description_get_type();
				GLib.GType ret = new GLib.GType(raw_ret);
				return ret;
			}
		}

		public bool Equals (WebRTCSessionDescription other)
		{
			return true && Type.Equals (other.Type) && Sdp.Equals (other.Sdp);
		}

		public override bool Equals (object other)
		{
			return other is WebRTCSessionDescription && Equals ((WebRTCSessionDescription) other);
		}

		public override int GetHashCode ()
		{
			return this.GetType ().FullName.GetHashCode () ^ Type.GetHashCode () ^ Sdp.GetHashCode ();
		}

		public static explicit operator GLib.Value (Gst.WebRTC.WebRTCSessionDescription boxed)
		{
			GLib.Value val = GLib.Value.Empty;
			val.Init (Gst.WebRTC.WebRTCSessionDescription.GType);
			val.Val = boxed;
			return val;
		}

		public static explicit operator Gst.WebRTC.WebRTCSessionDescription (GLib.Value val)
		{
			return (Gst.WebRTC.WebRTCSessionDescription) val.Val;
		}
#endregion
	}
}
