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

hub.exec.boto3.client.chime.create_meeting
hub.exec.boto3.client.chime.delete_meeting
hub.exec.boto3.client.chime.get_meeting
hub.exec.boto3.client.chime.list_meetings
hub.exec.boto3.client.chime.tag_meeting
hub.exec.boto3.client.chime.untag_meeting
"""



from typing import *
import dict_tools.differ as differ
async def present(hub, ctx, name: Text, client_request_token: Text, external_meeting_id: Text = None, meeting_host_id: Text = None, media_region: Text = None, tags: List = None, notifications_configuration: Dict = None)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
     Creates a new Amazon Chime SDK meeting in the specified media Region with no initial attendees. For more
    information about specifying media Regions, see Amazon Chime SDK Media Regions in the Amazon Chime Developer
    Guide . For more information about the Amazon Chime SDK, see Using the Amazon Chime SDK in the Amazon Chime
    Developer Guide .

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        client_request_token(Text): The unique identifier for the client request. Use a different token for different meetings.
        external_meeting_id(Text, optional): The external meeting ID. Defaults to None.
        meeting_host_id(Text, optional): Reserved. Defaults to None.
        media_region(Text, optional):  The Region in which to create the meeting. Default: us-east-1.   Available values: af-south-1 ,
            ap-northeast-1 , ap-northeast-2 , ap-south-1 , ap-southeast-1 , ap-southeast-2 , ca-central-1 ,
            eu-central-1 , eu-north-1 , eu-south-1 , eu-west-1 , eu-west-2 , eu-west-3 , sa-east-1 , us-
            east-1 , us-east-2 , us-west-1 , us-west-2 . Defaults to None.
        tags(List, optional): The tag key-value pairs. Defaults to None.
        notifications_configuration(Dict, optional): The configuration for resource targets to receive notifications when meeting and attendee events
            occur. Defaults to None.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

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

    if before:
        result["comment"] = f"'{name}' already exists"
    else:
        try:
            ret = await hub.exec.boto3.client.chime.create_meeting(
                ctx,
                
                
                **{"ClientRequestToken": client_request_token, "ExternalMeetingId": external_meeting_id, "MeetingHostId": meeting_host_id, "MediaRegion": media_region, "Tags": tags, "NotificationsConfiguration": notifications_configuration}
            )
            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_meeting(name)
    result["changes"] = differ.deep_diff(before, after)
    return result

async def absent(hub, ctx, name: Text, meeting_id: Text)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Deletes the specified Amazon Chime SDK meeting. The operation deletes all attendees, disconnects all clients,
    and prevents new clients from joining the meeting. For more information about the Amazon Chime SDK, see Using
    the Amazon Chime SDK in the Amazon Chime Developer Guide.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        meeting_id(Text): The Amazon Chime SDK meeting ID.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

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

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

