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

hub.exec.boto3.client.quicksight.create_theme_alias
hub.exec.boto3.client.quicksight.delete_theme_alias
hub.exec.boto3.client.quicksight.describe_theme_alias
hub.exec.boto3.client.quicksight.update_theme_alias
"""



from typing import *
import dict_tools.differ as differ
async def present(hub, ctx, name: Text, aws_account_id: Text, theme_id: Text, alias_name: Text, theme_version_number: int)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Creates a theme alias for a theme.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        aws_account_id(Text): The ID of the Amazon Web Services account; that contains the theme for the new theme alias.
        theme_id(Text): An ID for the theme alias.
        alias_name(Text): The name that you want to give to the theme alias that you are creating. The alias name can't
            begin with a $. Alias names that start with $ are reserved by Amazon QuickSight.
        theme_version_number(int): The version number of the theme.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

            resource_is_present:
              aws_auto.quicksight.theme_alias.present:
                - name: value
                - aws_account_id: value
                - theme_id: value
                - alias_name: value
                - theme_version_number: value
    '''
    
    result = dict(comment="", changes= None, name=name, result=True)
    ret = await hub.exec.boto3.client.quicksight.theme_alias.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.quicksight.describe_theme_alias(name)

    if before:
        result["comment"] = f"'{name}' already exists"
    else:
        try:
            ret = await hub.exec.boto3.client.quicksight.create_theme_alias(
                ctx,
                
                
                **{"AwsAccountId": aws_account_id, "ThemeId": theme_id, "AliasName": alias_name, "ThemeVersionNumber": theme_version_number}
            )
            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.quicksight.describe_theme_alias(name)
    result["changes"] = differ.deep_diff(before, after)
    return result

async def absent(hub, ctx, name: Text, aws_account_id: Text, theme_id: Text, alias_name: Text)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Deletes the version of the theme that the specified theme alias points to. If you provide a specific alias, you
    delete the version of the theme that the alias points to.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        aws_account_id(Text): The ID of the Amazon Web Services account; that contains the theme alias to delete.
        theme_id(Text): The ID for the theme that the specified alias is for.
        alias_name(Text): The unique name for the theme alias to delete.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

            resource_is_absent:
              aws_auto.quicksight.theme_alias.absent:
                - name: value
                - aws_account_id: value
                - theme_id: value
                - alias_name: value
    '''
    
    result = dict(comment="", changes= None, name=name, result=True)
    ret = await hub.exec.boto3.client.quicksight.theme_alias.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.quicksight.describe_theme_alias(name)

    if not before:
        result["comment"] = f"'{name}' already absent"
    else:
        try:
            ret = await hub.exec.boto3.client.quicksight.delete_theme_alias(
                ctx,
                
                
                **{"AwsAccountId": aws_account_id, "ThemeId": theme_id, "AliasName": alias_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.quicksight.describe_theme_alias(name)
    result["changes"] = differ.deep_diff(before, after)
    return result

