using System;

namespace winPEAS.Wifi.NativeWifiApi
{
    /// <summary>
    /// Defines flags passed to <see cref="WlanGetAvailableNetworkList"/>.
    /// </summary>
    [Flags]
    public enum WlanGetAvailableNetworkFlags
    {
        /// <summary>
        /// No additional flags
        /// </summary>
        None = 0,
        /// <summary>
        /// Include all ad-hoc network profiles in the available network list, including profiles that are not visible.
        /// </summary>
        IncludeAllAdhocProfiles = 0x00000001,
        /// <summary>
        /// Include all hidden network profiles in the available network list, including profiles that are not visible.
        /// </summary>
        IncludeAllManualHiddenProfiles = 0x00000002
    }

    [Flags]
    public enum WlanProfileFlags
    {
        // When getting profiles, the absence of the "User" or "GroupPolicy" flags implies that the profile
        // is an "AllUser" profile. This can also be viewed as having no flag -- hence "None" and "AllUser"
        // are equivalent
        None = 0,
        AllUser = 0,
        GroupPolicy = 1,
        User = 2,
        GetPlaintextKey = 4
    }

    /// <summary>
    /// Defines the access mask of an all-user profile.
    /// </summary>
    [Flags]
    public enum WlanAccess
    {
        /// <summary>
        /// The user can view profile permissions.
        /// </summary>
        ReadAccess = 0x00020000 | 0x0001,
        /// <summary>
        /// The user has read access, and the user can also connect to and disconnect from a network using the profile.
        /// </summary>
        ExecuteAccess = ReadAccess | 0x0020,
        /// <summary>
        /// The user has execute access and the user can also modify and delete permissions associated with a profile.
        /// </summary>
        WriteAccess = ReadAccess | ExecuteAccess | 0x0002 | 0x00010000 | 0x00040000
    }

    /// <summary>
    /// Specifies where the notification comes from.
    /// </summary>
    [Flags]
    public enum WlanNotificationSource
    {
        None = 0,
        /// <summary>
        /// All notifications, including those generated by the 802.1X module.
        /// </summary>
        All = 0X0000FFFF,
        /// <summary>
        /// Notifications generated by the auto configuration module.
        /// </summary>
        ACM = 0X00000008,
        /// <summary>
        /// Notifications generated by MSM.
        /// </summary>
        MSM = 0X00000010,
        /// <summary>
        /// Notifications generated by the security module.
        /// </summary>
        Security = 0X00000020,
        /// <summary>
        /// Notifications generated by independent hardware vendors (IHV).
        /// </summary>
        IHV = 0X00000040
    }

    /// <summary>
    /// Defines connection parameter flags.
    /// </summary>
    [Flags]
    public enum WlanConnectionFlags
    {
        /// <summary>
        /// Connect to the destination network even if the destination is a hidden network. A hidden network does not broadcast its SSID. Do not use this flag if the destination network is an ad-hoc network.
        /// <para>If the profile specified by <see cref="WlanConnectionParameters.profile"/> is not <c>null</c>, then this flag is ignored and the nonBroadcast profile element determines whether to connect to a hidden network.</para>
        /// </summary>
        HiddenNetwork = 0x00000001,
        /// <summary>
        /// Do not form an ad-hoc network. Only join an ad-hoc network if the network already exists. Do not use this flag if the destination network is an infrastructure network.
        /// </summary>
        AdhocJoinOnly = 0x00000002,
        /// <summary>
        /// Ignore the privacy bit when connecting to the network. Ignoring the privacy bit has the effect of ignoring whether packets are encryption and ignoring the method of encryption used. Only use this flag when connecting to an infrastructure network using a temporary profile.
        /// </summary>
        IgnorePrivacyBit = 0x00000004,
        /// <summary>
        /// Exempt EAPOL traffic from encryption and decryption. This flag is used when an application must send EAPOL traffic over an infrastructure network that uses Open authentication and WEP encryption. This flag must not be used to connect to networks that require 802.1X authentication. This flag is only valid when <see cref="WlanConnectionParameters.wlanConnectionMode"/> is set to <see cref="WlanConnectionMode.TemporaryProfile"/>. Avoid using this flag whenever possible.
        /// </summary>
        EapolPassthrough = 0x00000008
    }


    /// <summary>
    /// Indicates the state of an interface.
    /// </summary>
    /// <remarks>
    /// Corresponds to the native <c>WLAN_INTERFACE_STATE</c> type.
    /// </remarks>
    public enum WlanInterfaceState
    {
        /// <summary>
        /// The interface is not ready to operate.
        /// </summary>
        NotReady = 0,
        /// <summary>
        /// The interface is connected to a network.
        /// </summary>
        Connected = 1,
        /// <summary>
        /// The interface is the first node in an ad hoc network. No peer has connected.
        /// </summary>
        AdHocNetworkFormed = 2,
        /// <summary>
        /// The interface is disconnecting from the current network.
        /// </summary>
        Disconnecting = 3,
        /// <summary>
        /// The interface is not connected to any network.
        /// </summary>
        Disconnected = 4,
        /// <summary>
        /// The interface is attempting to associate with a network.
        /// </summary>
        Associating = 5,
        /// <summary>
        /// Auto configuration is discovering the settings for the network.
        /// </summary>
        Discovering = 6,
        /// <summary>
        /// The interface is in the process of authenticating.
        /// </summary>
        Authenticating = 7
    }


    /// <summary>
    /// Defines an 802.11 PHY and media type.
    /// </summary>
    /// <remarks>
    /// Corresponds to the native <c>DOT11_PHY_TYPE</c> type.
    /// </remarks>
    public enum Dot11PhyType : uint
    {
        /// <summary>
        /// Specifies an unknown or uninitialized PHY type.
        /// </summary>
        Unknown = 0,
        /// <summary>
        /// Specifies any PHY type.
        /// </summary>
        Any = Unknown,
        /// <summary>
        /// Specifies a frequency-hopping spread-spectrum (FHSS) PHY. Bluetooth devices can use FHSS or an adaptation of FHSS.
        /// </summary>
        FHSS = 1,
        /// <summary>
        /// Specifies a direct sequence spread spectrum (DSSS) PHY.
        /// </summary>
        DSSS = 2,
        /// <summary>
        /// Specifies an infrared (IR) baseband PHY.
        /// </summary>
        IrBaseband = 3,
        /// <summary>
        /// Specifies an orthogonal frequency division multiplexing (OFDM) PHY. 802.11a devices can use OFDM.
        /// </summary>
        OFDM = 4,
        /// <summary>
        /// Specifies a high-rate DSSS (HRDSSS) PHY.
        /// </summary>
        HRDSSS = 5,
        /// <summary>
        /// Specifies an extended rate PHY (ERP). 802.11g devices can use ERP.
        /// </summary>
        ERP = 6,
        /// <summary>
        /// Specifies the start of the range that is used to define PHY types that are developed by an independent hardware vendor (IHV).
        /// </summary>
        IHV_Start = 0x80000000,
        /// <summary>
        /// Specifies the end of the range that is used to define PHY types that are developed by an independent hardware vendor (IHV).
        /// </summary>
        IHV_End = 0xffffffff
    }

    /// <summary>
    /// Defines a basic service set (BSS) network type.
    /// </summary>
    /// <remarks>
    /// Corresponds to the native <c>DOT11_BSS_TYPE</c> type.
    /// </remarks>
    public enum Dot11BssType
    {
        /// <summary>
        /// Specifies an infrastructure BSS network.
        /// </summary>
        Infrastructure = 1,
        /// <summary>
        /// Specifies an independent BSS (IBSS) network.
        /// </summary>
        Independent = 2,
        /// <summary>
        /// Specifies either infrastructure or IBSS network.
        /// </summary>
        Any = 3
    }

    /// <summary>
    /// Defines the mode of connection.
    /// </summary>
    /// <remarks>
    /// Corresponds to the native <c>WLAN_CONNECTION_MODE</c> type.
    /// </remarks>
    public enum WlanConnectionMode
    {
        /// <summary>
        /// A profile will be used to make the connection.
        /// </summary>
        Profile = 0,
        /// <summary>
        /// A temporary profile will be used to make the connection.
        /// </summary>
        TemporaryProfile,
        /// <summary>
        /// Secure discovery will be used to make the connection.
        /// </summary>
        DiscoverySecure,
        /// <summary>
        /// Unsecure discovery will be used to make the connection.
        /// </summary>
        DiscoveryUnsecure,
        /// <summary>
        /// A connection will be made automatically, generally using a persistent profile.
        /// </summary>
        Auto,
        /// <summary>
        /// Not used.
        /// </summary>
        Invalid
    }
}
