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

hub.exec.boto3.client.mediaconvert.create_queue
hub.exec.boto3.client.mediaconvert.delete_queue
hub.exec.boto3.client.mediaconvert.get_queue
hub.exec.boto3.client.mediaconvert.list_queues
hub.exec.boto3.client.mediaconvert.update_queue
"""



from typing import *
import dict_tools.differ as differ
async def present(hub, ctx, name: Text, description: Text = None, pricing_plan: Text = None, reservation_plan_settings: Dict = None, status: Text = None, tags: Dict = None)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Create a new transcoding queue. For information about queues, see Working With Queues in the User Guide at
    https://docs.aws.amazon.com/mediaconvert/latest/ug/working-with-queues.html

    Args:
        name(Text): The name of the queue that you are creating.
        description(Text, optional): Optional. A description of the queue that you are creating. Defaults to None.
        pricing_plan(Text, optional): Specifies whether the pricing plan for the queue is on-demand or reserved. For on-demand, you
            pay per minute, billed in increments of .01 minute. For reserved, you pay for the transcoding
            capacity of the entire queue, regardless of how much or how little you use it. Reserved pricing
            requires a 12-month commitment. When you use the API to create a queue, the default is on-
            demand. Defaults to None.
        reservation_plan_settings(Dict, optional): Details about the pricing plan for your reserved queue. Required for reserved queues and not
            applicable to on-demand queues. Defaults to None.
        status(Text, optional): Initial state of the queue. If you create a paused queue, then jobs in that queue won't begin. Defaults to None.
        tags(Dict, optional): The tags that you want to add to the resource. You can tag resources with a key-value pair or
            with only a key. Defaults to None.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

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

    if before:
        result["comment"] = f"'{name}' already exists"
    else:
        try:
            ret = await hub.exec.boto3.client.mediaconvert.create_queue(
                ctx,
                
                
                **{"Name": name, "Description": description, "PricingPlan": pricing_plan, "ReservationPlanSettings": reservation_plan_settings, "Status": status, "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.mediaconvert.get_queue(name)
    result["changes"] = differ.deep_diff(before, after)
    return result

async def absent(hub, ctx, name: Text)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Permanently delete a queue you have created.

    Args:
        name(Text): The name of the queue that you want to delete.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

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

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

