"""
Autogenerated state module using `pop-create-idem <https://gitlab.com/saltstack/pop/pop-create-idem>`__

hub.exec.boto3.client.alexaforbusiness.create_network_profile
hub.exec.boto3.client.alexaforbusiness.delete_network_profile
hub.exec.boto3.client.alexaforbusiness.get_network_profile
hub.exec.boto3.client.alexaforbusiness.search_network_profiles
hub.exec.boto3.client.alexaforbusiness.update_network_profile
"""



from typing import *
import dict_tools.differ as differ
async def present(hub, ctx, name: Text, network_profile_name: Text, ssid: Text, security_type: Text, client_request_token: Text, description: Text = None, eap_method: Text = None, current_password: Text = None, next_password: Text = None, certificate_authority_arn: Text = None, trust_anchors: List = None, tags: List = None)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Creates a network profile with the specified details.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        network_profile_name(Text): The name of the network profile associated with a device.
        description(Text, optional): Detailed information about a device's network profile. Defaults to None.
        ssid(Text): The SSID of the Wi-Fi network.
        security_type(Text): The security type of the Wi-Fi network. This can be WPA2_ENTERPRISE, WPA2_PSK, WPA_PSK, WEP, or
            OPEN.
        eap_method(Text, optional): The authentication standard that is used in the EAP framework. Currently, EAP_TLS is supported. Defaults to None.
        current_password(Text, optional): The current password of the Wi-Fi network. Defaults to None.
        next_password(Text, optional): The next, or subsequent, password of the Wi-Fi network. This password is asynchronously
            transmitted to the device and is used when the password of the network changes to NextPassword. Defaults to None.
        certificate_authority_arn(Text, optional): The ARN of the Private Certificate Authority (PCA) created in AWS Certificate Manager (ACM).
            This is used to issue certificates to the devices. Defaults to None.
        trust_anchors(List, optional): The root certificates of your authentication server that is installed on your devices and used
            to trust your authentication server during EAP negotiation. Defaults to None.
        client_request_token(Text): A unique, user-specified identifier for the request that ensures idempotency.
        tags(List, optional): The tags to be added to the specified resource. Do not provide system tags. Defaults to None.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

            resource_is_present:
              aws_auto.alexaforbusiness.network_profile.present:
                - name: value
                - network_profile_name: value
                - ssid: value
                - security_type: value
                - client_request_token: value
    '''
    
    result = dict(comment="", changes= None, name=name, result=True)
    ret = await hub.exec.boto3.client.alexaforbusiness.network_profile.id(
        ctx,
        jmes_path=name
    )
    if ret["status"]:
        # name is now the first id that matched the JMES search path
        name = ret["ret"]
    

    
    before = await hub.exec.boto3.client.alexaforbusiness.get_network_profile(name)

    if before:
        result["comment"] = f"'{name}' already exists"
    else:
        try:
            ret = await hub.exec.boto3.client.alexaforbusiness.create_network_profile(
                ctx,
                
                
                **{"NetworkProfileName": network_profile_name, "Description": description, "Ssid": ssid, "SecurityType": security_type, "EapMethod": eap_method, "CurrentPassword": current_password, "NextPassword": next_password, "CertificateAuthorityArn": certificate_authority_arn, "TrustAnchors": trust_anchors, "ClientRequestToken": client_request_token, "Tags": tags}
            )
            result["result"] = ret["status"]
            if not result["result"]:
                result["comment"] = ret["comment"]
                return result
            ret["comment"] = f"Created '{name}'"
        except hub.tool.boto3.exception.ClientError as e:
            result["comment"] = f"{e.__class__.__name__}: {e}"

    
    # TODO perform other modifications as needed here
    ...

    after = await hub.exec.boto3.client.alexaforbusiness.get_network_profile(name)
    result["changes"] = differ.deep_diff(before, after)
    return result

async def absent(hub, ctx, name: Text, network_profile_arn: Text)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Deletes a network profile by the network profile ARN.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        network_profile_arn(Text): The ARN of the network profile associated with a device.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

            resource_is_absent:
              aws_auto.alexaforbusiness.network_profile.absent:
                - name: value
                - network_profile_arn: value
    '''
    
    result = dict(comment="", changes= None, name=name, result=True)
    ret = await hub.exec.boto3.client.alexaforbusiness.network_profile.id(
        ctx,
        jmes_path=name
    )
    if ret["status"]:
        # name is now the first id that matched the JMES search path
        name = ret["ret"]
    

    

    before = await hub.exec.boto3.client.alexaforbusiness.get_network_profile(name)

    if not before:
        result["comment"] = f"'{name}' already absent"
    else:
        try:
            ret = await hub.exec.boto3.client.alexaforbusiness.delete_network_profile(
                ctx,
                
                
                **{"NetworkProfileArn": network_profile_arn}
            )
            result["result"] = ret["status"]
            if not result["result"]:
                result["comment"] = ret["comment"]
                return result
            result["comment"] = f"Deleted '{name}'"
        except hub.tool.boto3.exception.ClientError as e:
            result["comment"] = f"{e.__class__.__name__}: {e}"

    

    after = await hub.exec.boto3.client.alexaforbusiness.get_network_profile(name)
    result["changes"] = differ.deep_diff(before, after)
    return result

