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

hub.exec.boto3.client.license_manager.create_license_manager_report_generator
hub.exec.boto3.client.license_manager.delete_license_manager_report_generator
hub.exec.boto3.client.license_manager.get_license_manager_report_generator
hub.exec.boto3.client.license_manager.list_license_manager_report_generators
hub.exec.boto3.client.license_manager.update_license_manager_report_generator
"""



from typing import *
import dict_tools.differ as differ
async def present(hub, ctx, name: Text, report_generator_name: Text, type_: List, report_context: Dict, report_frequency: Dict, description: Text = None, tags: List = None)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Creates a new report generator.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        report_generator_name(Text): Name of the report generator.
        type_(List): Type of reports to generate. The following report types an be generated:   License configuration
            report - Reports on the number and details of consumed licenses for a license configuration.
            Resource report - Reports on the tracked licenses and resource consumption for a license
            configuration.
        report_context(Dict): Defines the type of license configuration the report generator tracks.
        report_frequency(Dict): Frequency by which reports are generated. Reports can be generated daily, monthly, or weekly.
        description(Text, optional): Description of the report generator. Defaults to None.
        tags(List, optional): Tags to add to the report generator. Defaults to None.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

            resource_is_present:
              aws_auto.license_manager.license_manager_report_generator.present:
                - name: value
                - report_generator_name: value
                - type_: value
                - report_context: value
                - report_frequency: value
    '''
    
    result = dict(comment="", changes= None, name=name, result=True)
    ret = await hub.exec.boto3.client.license_manager.license_manager_report_generator.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.license_manager.get_license_manager_report_generator(name)

    if before:
        result["comment"] = f"'{name}' already exists"
    else:
        try:
            ret = await hub.exec.boto3.client.license_manager.create_license_manager_report_generator(
                ctx,
                
                ClientToken=name,
                **{"ReportGeneratorName": report_generator_name, "Type": type_, "ReportContext": report_context, "ReportFrequency": report_frequency, "Description": description, "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.license_manager.get_license_manager_report_generator(name)
    result["changes"] = differ.deep_diff(before, after)
    return result

async def absent(hub, ctx, name: Text, license_manager_report_generator_arn: Text)  -> Dict[str, Any]:
    r'''
    **Autogenerated function**
    
    Delete an existing report generator. This action deletes the report generator, which stops it from generating
    future reports and cannot be reversed. However, the previous reports from this generator will remain in your S3
    bucket.

    Args:
        name(Text): A name, ID, or JMES search path to identify the resource.
        license_manager_report_generator_arn(Text): Amazon Resource Number (ARN) of the report generator that will be deleted.

    Returns:
        Dict[str, Any]

    Examples:

        .. code-block:: sls

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

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

