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

hub.exec.boto3.client.lexv2_models.create_slot
hub.exec.boto3.client.lexv2_models.delete_slot
hub.exec.boto3.client.lexv2_models.describe_slot
hub.exec.boto3.client.lexv2_models.list_slots
hub.exec.boto3.client.lexv2_models.update_slot
"""



from typing import *
import dict_tools.differ as differ
async def present(hub, ctx, name: Text, slot_name: Text, slot_type_id: Text, value_elicitation_setting: Dict, bot_id: Text, bot_version: Text, locale_id: Text, intent_id: Text, description: Text = None, obfuscation_setting: Dict = None, multiple_values_setting: Dict = None)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Creates a slot in an intent. A slot is a variable needed to fulfill an intent. For example, an OrderPizza intent
    might need slots for size, crust, and number of pizzas. For each slot, you define one or more utterances that
    Amazon Lex uses to elicit a response from the user.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        slot_name(Text): The name of the slot. Slot names must be unique within the bot that contains the slot.
        description(Text, optional): A description of the slot. Use this to help identify the slot in lists. Defaults to None.
        slot_type_id(Text): The unique identifier for the slot type associated with this slot. The slot type determines the
            values that can be entered into the slot.
        value_elicitation_setting(Dict): Specifies prompts that Amazon Lex sends to the user to elicit a response that provides the value
            for the slot.
        obfuscation_setting(Dict, optional): Determines how slot values are used in Amazon CloudWatch logs. If the value of the
            obfuscationSetting parameter is DefaultObfuscation, slot values are obfuscated in the log
            output. If the value is None, the actual value is present in the log output. The default is to
            obfuscate values in the CloudWatch logs. Defaults to None.
        bot_id(Text): The identifier of the bot associated with the slot.
        bot_version(Text): The version of the bot associated with the slot.
        locale_id(Text): The identifier of the language and locale that the slot will be used in. The string must match
            one of the supported locales. All of the bots, intents, slot types used by the slot must have
            the same locale. For more information, see Supported languages.
        intent_id(Text): The identifier of the intent that contains the slot.
        multiple_values_setting(Dict, optional): Indicates whether the slot returns multiple values in one response. Multi-value slots are only
            available in the en-US locale. If you set this value to true in any other locale, Amazon Lex
            throws a ValidationException.  If the multipleValuesSetting is not set, the default value is
            false. Defaults to None.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

            resource_is_present:
              aws_auto.lexv2_models.slot.present:
                - name: value
                - slot_name: value
                - slot_type_id: value
                - value_elicitation_setting: value
                - bot_id: value
                - bot_version: value
                - locale_id: value
                - intent_id: value
    '''
    
    result = dict(comment="", changes= None, name=name, result=True)
    ret = await hub.exec.boto3.client.lexv2_models.slot.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.lexv2_models.describe_slot(name)

    if before:
        result["comment"] = f"'{name}' already exists"
    else:
        try:
            ret = await hub.exec.boto3.client.lexv2_models.create_slot(
                ctx,
                
                
                **{"slotName": slot_name, "description": description, "slotTypeId": slot_type_id, "valueElicitationSetting": value_elicitation_setting, "obfuscationSetting": obfuscation_setting, "botId": bot_id, "botVersion": bot_version, "localeId": locale_id, "intentId": intent_id, "multipleValuesSetting": multiple_values_setting}
            )
            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.lexv2_models.describe_slot(name)
    result["changes"] = differ.deep_diff(before, after)
    return result

async def absent(hub, ctx, name: Text, slot_id: Text, bot_id: Text, bot_version: Text, locale_id: Text, intent_id: Text)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Deletes the specified slot from an intent.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        slot_id(Text): The identifier of the slot to delete.
        bot_id(Text): The identifier of the bot associated with the slot to delete.
        bot_version(Text): The version of the bot associated with the slot to delete.
        locale_id(Text): The identifier of the language and locale that the slot will be deleted from. The string must
            match one of the supported locales. For more information, see Supported languages.
        intent_id(Text): The identifier of the intent associated with the slot.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

            resource_is_absent:
              aws_auto.lexv2_models.slot.absent:
                - name: value
                - slot_id: value
                - bot_id: value
                - bot_version: value
                - locale_id: value
                - intent_id: value
    '''
    
    result = dict(comment="", changes= None, name=name, result=True)
    ret = await hub.exec.boto3.client.lexv2_models.slot.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.lexv2_models.describe_slot(name)

    if not before:
        result["comment"] = f"'{name}' already absent"
    else:
        try:
            ret = await hub.exec.boto3.client.lexv2_models.delete_slot(
                ctx,
                
                
                **{"slotId": slot_id, "botId": bot_id, "botVersion": bot_version, "localeId": locale_id, "intentId": intent_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.lexv2_models.describe_slot(name)
    result["changes"] = differ.deep_diff(before, after)
    return result

