using System;
using System.Runtime.InteropServices;

namespace NZSDK_CSharpSample
{
    public partial class NZLiveDisplay
    {
        #region Constraints

        [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
        public struct DeviceInfo
        {
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
            public string Address;
            public int Port;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
            public string Url;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
            public string LoginId;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
            public string Password;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 512)]
            public string Key;
            public int Reserved1;
            public int Reserved2;
            public int Reserved3;
        }

        [StructLayout(LayoutKind.Sequential)]
        public struct GdiBitmap
        {
            public int bmType;
            public int bmWidth;
            public int bmHeight;
            public int bmWidthBytes;
            public ushort bmPlanes;
            public ushort bmBitsPixel;
            public IntPtr bmBits;
        }

        [StructLayout(LayoutKind.Sequential, Pack = 1)]
        public struct GdiRect
        {
            public int left;
            public int top;
            public int right;
            public int bottom;
        }

        public delegate bool DrawVideoDelegate(int channel, IntPtr pBitmap, IntPtr pSrcRect, IntPtr pUserParam);

        public const UInt32 CommandBase = 0x00000000;

        public enum Commands : uint
        {
            Open = CommandBase | 0x00000001,
            Enable = CommandBase | 0x00000002,
            Connecting = CommandBase | 0x00000003,
            OpenVideo = CommandBase | 0x00000004,
            CloseVideo = CommandBase | 0x00000005,
            SetLogoImage = CommandBase | 0x00000006,
            SetOSDText = CommandBase | 0x00000007,
            SetOSDSetting = CommandBase | 0x00000008,
            SetWindowPosition = CommandBase | 0x00000009,
            EnableScreenPtz = CommandBase | 0x0000000A,
            SetCustomDrawHandler = CommandBase | 0x0000000B
        }

        #endregion

        #region NZLDCreate

        protected delegate IntPtr NZLDCreateDelegate();

        protected NZLDCreateDelegate _NZLDCreate
        {
            get
            {
                return (NZLDCreateDelegate)GetProcAddress("NZLD_Create", typeof(NZLDCreateDelegate));
            }
        }

        #endregion

        #region NZLDDelete

        protected delegate bool NZLDDeleteDelegate(IntPtr handle);

        protected NZLDDeleteDelegate _NZLDDelete
        {
            get
            {
                return (NZLDDeleteDelegate)GetProcAddress("NZLD_Delete", typeof(NZLDDeleteDelegate));
            }
        }

        #endregion

        #region NZLDCommand

        protected delegate bool NZLDCommandDelegate(IntPtr handle, Commands command, IntPtr arg1, IntPtr arg2, IntPtr arg3, IntPtr arg4);

        protected NZLDCommandDelegate _NZLDCommand
        {
            get
            {
                return (NZLDCommandDelegate)GetProcAddress("NZLD_Command", typeof(NZLDCommandDelegate));
            }
        }

        #endregion
    }
}