#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member

using System;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;

namespace Volpe.Cafe.Utils.Win32Native
{
    /// <summary>
    /// *** WARNING -- USE WITH CAUTION *** <br/>
    /// Use provided wrappers in <see cref="Win32"/> class whenever possible.<br/>
    /// <br/>
    /// Defines safe native win32 methods.
    /// </summary>
    [SuppressUnmanagedCodeSecurity]
    public class SafeNativeMethods
    {
        // SetProcessDPIAware -- min client OS: windows vista; min server OS: windows server 2008
        [DllImport(ExternDll.User32, CharSet = CharSet.Auto, SetLastError = true)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool SetProcessDPIAware();

        // SetProcessDpiAwareness -- min client OS: windows 8.1; min server OS: windows server 2012 R2
        [DllImport(ExternDll.ShCore, CharSet = CharSet.Auto, SetLastError = true)]
        [ResourceExposure(ResourceScope.None)]
        public static extern int SetProcessDpiAwareness(ProcessDpiAwareness awareness);

        [DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool RedrawWindow(IntPtr hwnd, IntPtr lprcUpdate, IntPtr hrgnUpdate, int flags);

        [DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Auto)]
        [ResourceExposure(ResourceScope.None)]
        public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter,
                                               int x, int y, int cx, int cy, int flags);

    }
}
