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

hub.exec.boto3.client.alexaforbusiness.delete_room_skill_parameter
hub.exec.boto3.client.alexaforbusiness.get_room_skill_parameter
hub.exec.boto3.client.alexaforbusiness.put_room_skill_parameter
"""



from typing import *
import dict_tools.differ as differ
async def present(hub, ctx, name: Text, skill_id: Text, room_skill_parameter: Dict, room_arn: Text = None)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Updates room skill parameter details by room, skill, and parameter key ID. Not all skills have a room skill
    parameter.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        room_arn(Text, optional): The ARN of the room associated with the room skill parameter. Required. Defaults to None.
        skill_id(Text): The ARN of the skill associated with the room skill parameter. Required.
        room_skill_parameter(Dict): The updated room skill parameter. Required.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

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

    if before:
        result["comment"] = f"'{name}' already exists"
    else:
        try:
            ret = await hub.exec.boto3.client.alexaforbusiness.put_room_skill_parameter(
                ctx,
                
                
                **{"RoomArn": room_arn, "SkillId": skill_id, "RoomSkillParameter": room_skill_parameter}
            )
            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.alexaforbusiness.get_room_skill_parameter(name)
    result["changes"] = differ.deep_diff(before, after)
    return result

async def absent(hub, ctx, name: Text, skill_id: Text, parameter_key: Text, room_arn: Text = None)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Deletes room skill parameter details by room, skill, and parameter key ID.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        room_arn(Text, optional): The ARN of the room from which to remove the room skill parameter details. Defaults to None.
        skill_id(Text): The ID of the skill from which to remove the room skill parameter details.
        parameter_key(Text): The room skill parameter key for which to remove details.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

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

    if not before:
        result["comment"] = f"'{name}' already absent"
    else:
        try:
            ret = await hub.exec.boto3.client.alexaforbusiness.delete_room_skill_parameter(
                ctx,
                
                
                **{"RoomArn": room_arn, "SkillId": skill_id, "ParameterKey": parameter_key}
            )
            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.alexaforbusiness.get_room_skill_parameter(name)
    result["changes"] = differ.deep_diff(before, after)
    return result

