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

hub.exec.boto3.client.sagemaker.create_human_task_ui
hub.exec.boto3.client.sagemaker.delete_human_task_ui
hub.exec.boto3.client.sagemaker.describe_human_task_ui
"""



from typing import *
import dict_tools.differ as differ
async def present(hub, ctx, name: Text, human_task_ui_name: Text, ui_template: Dict, tags: List = None)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Defines the settings you will use for the human review workflow user interface. Reviewers will see a three-panel
    interface with an instruction area, the item to review, and an input area.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        human_task_ui_name(Text): The name of the user interface you are creating.
        ui_template(Dict): The Liquid template for the worker user interface.
        tags(List, optional): An array of key-value pairs that contain metadata to help you categorize and organize a human
            review workflow user interface. Each tag consists of a key and a value, both of which you
            define. Defaults to None.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

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

    if before:
        result["comment"] = f"'{name}' already exists"
    else:
        try:
            ret = await hub.exec.boto3.client.sagemaker.create_human_task_ui(
                ctx,
                
                
                **{"HumanTaskUiName": human_task_ui_name, "UiTemplate": ui_template, "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.sagemaker.describe_human_task_ui(name)
    result["changes"] = differ.deep_diff(before, after)
    return result

async def absent(hub, ctx, name: Text, human_task_ui_name: Text)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Use this operation to delete a human task user interface (worker task template).  To see a list of human task
    user interfaces (work task templates) in your account, use . When you delete a worker task template, it no
    longer appears when you call ListHumanTaskUis.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        human_task_ui_name(Text): The name of the human task user interface (work task template) you want to delete.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

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

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

