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

hub.exec.boto3.client.chime.delete_voice_connector_proxy
hub.exec.boto3.client.chime.get_voice_connector_proxy
hub.exec.boto3.client.chime.put_voice_connector_proxy
"""



from typing import *
import dict_tools.differ as differ
async def present(hub, ctx, name: Text, voice_connector_id: Text, default_session_expiry_minutes: int, phone_number_pool_countries: List, fall_back_phone_number: Text = None, disabled: bool = None)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Puts the specified proxy configuration to the specified Amazon Chime Voice Connector.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        voice_connector_id(Text): The Amazon Chime voice connector ID.
        default_session_expiry_minutes(int): The default number of minutes allowed for proxy sessions.
        phone_number_pool_countries(List): The countries for proxy phone numbers to be selected from.
        fall_back_phone_number(Text, optional): The phone number to route calls to after a proxy session expires. Defaults to None.
        disabled(bool, optional): When true, stops proxy sessions from being created on the specified Amazon Chime Voice
            Connector. Defaults to None.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

            resource_is_present:
              aws_auto.chime.voice_connector_proxy.present:
                - name: value
                - voice_connector_id: value
                - default_session_expiry_minutes: value
                - phone_number_pool_countries: value
    '''
    
    result = dict(comment="", changes= None, name=name, result=True)
    ret = await hub.exec.boto3.client.chime.voice_connector_proxy.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.chime.get_voice_connector_proxy(name)

    if before:
        result["comment"] = f"'{name}' already exists"
    else:
        try:
            ret = await hub.exec.boto3.client.chime.put_voice_connector_proxy(
                ctx,
                
                
                **{"VoiceConnectorId": voice_connector_id, "DefaultSessionExpiryMinutes": default_session_expiry_minutes, "PhoneNumberPoolCountries": phone_number_pool_countries, "FallBackPhoneNumber": fall_back_phone_number, "Disabled": disabled}
            )
            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.chime.get_voice_connector_proxy(name)
    result["changes"] = differ.deep_diff(before, after)
    return result

async def absent(hub, ctx, name: Text, voice_connector_id: Text)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Deletes the proxy configuration from the specified Amazon Chime Voice Connector.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        voice_connector_id(Text): The Amazon Chime Voice Connector ID.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

            resource_is_absent:
              aws_auto.chime.voice_connector_proxy.absent:
                - name: value
                - voice_connector_id: value
    '''
    
    result = dict(comment="", changes= None, name=name, result=True)
    ret = await hub.exec.boto3.client.chime.voice_connector_proxy.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.chime.get_voice_connector_proxy(name)

    if not before:
        result["comment"] = f"'{name}' already absent"
    else:
        try:
            ret = await hub.exec.boto3.client.chime.delete_voice_connector_proxy(
                ctx,
                
                
                **{"VoiceConnectorId": voice_connector_id}
            )
            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.chime.get_voice_connector_proxy(name)
    result["changes"] = differ.deep_diff(before, after)
    return result

