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

hub.exec.boto3.client.transcribe.create_vocabulary_filter
hub.exec.boto3.client.transcribe.delete_vocabulary_filter
hub.exec.boto3.client.transcribe.get_vocabulary_filter
hub.exec.boto3.client.transcribe.list_vocabulary_filters
hub.exec.boto3.client.transcribe.update_vocabulary_filter
"""



from typing import *
import dict_tools.differ as differ
async def present(hub, ctx, name: Text, vocabulary_filter_name: Text, language_code: Text, words: List = None, vocabulary_filter_file_uri: Text = None)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Creates a new vocabulary filter that you can use to filter words, such as profane words, from the output of a
    transcription job.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        vocabulary_filter_name(Text): The vocabulary filter name. The name must be unique within the account that contains it. If you
            try to create a vocabulary filter with the same name as another vocabulary filter, you get a
            ConflictException error.
        language_code(Text): The language code of the words in the vocabulary filter. All words in the filter must be in the
            same language. The vocabulary filter can only be used with transcription jobs in the specified
            language.
        words(List, optional): The words to use in the vocabulary filter. Only use characters from the character set defined
            for custom vocabularies. For a list of character sets, see Character Sets for Custom
            Vocabularies. If you provide a list of words in the Words parameter, you can't use the
            VocabularyFilterFileUri parameter. Defaults to None.
        vocabulary_filter_file_uri(Text, optional): The Amazon S3 location of a text file used as input to create the vocabulary filter. Only use
            characters from the character set defined for custom vocabularies. For a list of character sets,
            see Character Sets for Custom Vocabularies. The specified file must be less than 50 KB of UTF-8
            characters. If you provide the location of a list of words in the VocabularyFilterFileUri
            parameter, you can't use the Words parameter. Defaults to None.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

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

    if before:
        result["comment"] = f"'{name}' already exists"
    else:
        try:
            ret = await hub.exec.boto3.client.transcribe.create_vocabulary_filter(
                ctx,
                
                
                **{"VocabularyFilterName": vocabulary_filter_name, "LanguageCode": language_code, "Words": words, "VocabularyFilterFileUri": vocabulary_filter_file_uri}
            )
            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.transcribe.get_vocabulary_filter(name)
    result["changes"] = differ.deep_diff(before, after)
    return result

async def absent(hub, ctx, name: Text, vocabulary_filter_name: Text)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Removes a vocabulary filter.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        vocabulary_filter_name(Text): The name of the vocabulary filter to remove.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

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

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

