// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.policyinsights.implementation;

import com.azure.core.http.rest.PagedIterable;
import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.policyinsights.fluent.PolicyTrackedResourcesClient;
import com.azure.resourcemanager.policyinsights.fluent.models.PolicyTrackedResourceInner;
import com.azure.resourcemanager.policyinsights.models.PolicyTrackedResource;
import com.azure.resourcemanager.policyinsights.models.PolicyTrackedResources;
import com.azure.resourcemanager.policyinsights.models.PolicyTrackedResourcesResourceType;

public final class PolicyTrackedResourcesImpl implements PolicyTrackedResources {
    private static final ClientLogger LOGGER = new ClientLogger(PolicyTrackedResourcesImpl.class);

    private final PolicyTrackedResourcesClient innerClient;

    private final com.azure.resourcemanager.policyinsights.PolicyInsightsManager serviceManager;

    public PolicyTrackedResourcesImpl(
        PolicyTrackedResourcesClient innerClient,
        com.azure.resourcemanager.policyinsights.PolicyInsightsManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public PagedIterable<PolicyTrackedResource> listQueryResultsForManagementGroup(
        String managementGroupName, PolicyTrackedResourcesResourceType policyTrackedResourcesResource) {
        PagedIterable<PolicyTrackedResourceInner> inner =
            this
                .serviceClient()
                .listQueryResultsForManagementGroup(managementGroupName, policyTrackedResourcesResource);
        return Utils.mapPage(inner, inner1 -> new PolicyTrackedResourceImpl(inner1, this.manager()));
    }

    public PagedIterable<PolicyTrackedResource> listQueryResultsForManagementGroup(
        String managementGroupName,
        PolicyTrackedResourcesResourceType policyTrackedResourcesResource,
        Integer top,
        String filter,
        Context context) {
        PagedIterable<PolicyTrackedResourceInner> inner =
            this
                .serviceClient()
                .listQueryResultsForManagementGroup(
                    managementGroupName, policyTrackedResourcesResource, top, filter, context);
        return Utils.mapPage(inner, inner1 -> new PolicyTrackedResourceImpl(inner1, this.manager()));
    }

    public PagedIterable<PolicyTrackedResource> listQueryResultsForSubscription(
        PolicyTrackedResourcesResourceType policyTrackedResourcesResource) {
        PagedIterable<PolicyTrackedResourceInner> inner =
            this.serviceClient().listQueryResultsForSubscription(policyTrackedResourcesResource);
        return Utils.mapPage(inner, inner1 -> new PolicyTrackedResourceImpl(inner1, this.manager()));
    }

    public PagedIterable<PolicyTrackedResource> listQueryResultsForSubscription(
        PolicyTrackedResourcesResourceType policyTrackedResourcesResource,
        Integer top,
        String filter,
        Context context) {
        PagedIterable<PolicyTrackedResourceInner> inner =
            this.serviceClient().listQueryResultsForSubscription(policyTrackedResourcesResource, top, filter, context);
        return Utils.mapPage(inner, inner1 -> new PolicyTrackedResourceImpl(inner1, this.manager()));
    }

    public PagedIterable<PolicyTrackedResource> listQueryResultsForResourceGroup(
        String resourceGroupName, PolicyTrackedResourcesResourceType policyTrackedResourcesResource) {
        PagedIterable<PolicyTrackedResourceInner> inner =
            this.serviceClient().listQueryResultsForResourceGroup(resourceGroupName, policyTrackedResourcesResource);
        return Utils.mapPage(inner, inner1 -> new PolicyTrackedResourceImpl(inner1, this.manager()));
    }

    public PagedIterable<PolicyTrackedResource> listQueryResultsForResourceGroup(
        String resourceGroupName,
        PolicyTrackedResourcesResourceType policyTrackedResourcesResource,
        Integer top,
        String filter,
        Context context) {
        PagedIterable<PolicyTrackedResourceInner> inner =
            this
                .serviceClient()
                .listQueryResultsForResourceGroup(
                    resourceGroupName, policyTrackedResourcesResource, top, filter, context);
        return Utils.mapPage(inner, inner1 -> new PolicyTrackedResourceImpl(inner1, this.manager()));
    }

    public PagedIterable<PolicyTrackedResource> listQueryResultsForResource(
        String resourceId, PolicyTrackedResourcesResourceType policyTrackedResourcesResource) {
        PagedIterable<PolicyTrackedResourceInner> inner =
            this.serviceClient().listQueryResultsForResource(resourceId, policyTrackedResourcesResource);
        return Utils.mapPage(inner, inner1 -> new PolicyTrackedResourceImpl(inner1, this.manager()));
    }

    public PagedIterable<PolicyTrackedResource> listQueryResultsForResource(
        String resourceId,
        PolicyTrackedResourcesResourceType policyTrackedResourcesResource,
        Integer top,
        String filter,
        Context context) {
        PagedIterable<PolicyTrackedResourceInner> inner =
            this
                .serviceClient()
                .listQueryResultsForResource(resourceId, policyTrackedResourcesResource, top, filter, context);
        return Utils.mapPage(inner, inner1 -> new PolicyTrackedResourceImpl(inner1, this.manager()));
    }

    private PolicyTrackedResourcesClient serviceClient() {
        return this.innerClient;
    }

    private com.azure.resourcemanager.policyinsights.PolicyInsightsManager manager() {
        return this.serviceManager;
    }
}
