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

hub.exec.boto3.client.frauddetector.cancel_batch_prediction_job
hub.exec.boto3.client.frauddetector.create_batch_prediction_job
hub.exec.boto3.client.frauddetector.delete_batch_prediction_job
hub.exec.boto3.client.frauddetector.get_batch_prediction_jobs
"""



from typing import *
import dict_tools.differ as differ
async def present(hub, ctx, name: Text, job_id: Text, input_path: Text, output_path: Text, event_type_name: Text, detector_name: Text, iam_role_arn: Text, detector_version: Text = None, tags: List = None)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Creates a batch prediction job.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        job_id(Text): The ID of the batch prediction job.
        input_path(Text): The Amazon S3 location of your training file.
        output_path(Text): The Amazon S3 location of your output file.
        event_type_name(Text): The name of the event type.
        detector_name(Text): The name of the detector.
        detector_version(Text, optional): The detector version. Defaults to None.
        iam_role_arn(Text): The ARN of the IAM role to use for this job request.
        tags(List, optional): A collection of key and value pairs. Defaults to None.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

            resource_is_present:
              aws_auto.frauddetector.batch_prediction_job.present:
                - name: value
                - job_id: value
                - input_path: value
                - output_path: value
                - event_type_name: value
                - detector_name: value
                - iam_role_arn: value
    '''
    
    result = dict(comment="", changes= None, name=name, result=True)
    ret = await hub.exec.boto3.client.frauddetector.batch_prediction_job.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.frauddetector.get_batch_prediction_jobs(name)

    if before:
        result["comment"] = f"'{name}' already exists"
    else:
        try:
            ret = await hub.exec.boto3.client.frauddetector.create_batch_prediction_job(
                ctx,
                
                
                **{"jobId": job_id, "inputPath": input_path, "outputPath": output_path, "eventTypeName": event_type_name, "detectorName": detector_name, "detectorVersion": detector_version, "iamRoleArn": iam_role_arn, "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.frauddetector.get_batch_prediction_jobs(name)
    result["changes"] = differ.deep_diff(before, after)
    return result

async def absent(hub, ctx, name: Text, job_id: Text)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Deletes a batch prediction job.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        job_id(Text): The ID of the batch prediction job to delete.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

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

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

