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

package com.azure.resourcemanager.maintenance.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.maintenance.fluent.MaintenanceConfigurationsForResourceGroupsClient;
import com.azure.resourcemanager.maintenance.fluent.models.MaintenanceConfigurationInner;
import com.azure.resourcemanager.maintenance.models.MaintenanceConfiguration;
import com.azure.resourcemanager.maintenance.models.MaintenanceConfigurationsForResourceGroups;

public final class MaintenanceConfigurationsForResourceGroupsImpl
    implements MaintenanceConfigurationsForResourceGroups {
    private static final ClientLogger LOGGER = new ClientLogger(MaintenanceConfigurationsForResourceGroupsImpl.class);

    private final MaintenanceConfigurationsForResourceGroupsClient innerClient;

    private final com.azure.resourcemanager.maintenance.MaintenanceManager serviceManager;

    public MaintenanceConfigurationsForResourceGroupsImpl(
        MaintenanceConfigurationsForResourceGroupsClient innerClient,
        com.azure.resourcemanager.maintenance.MaintenanceManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public PagedIterable<MaintenanceConfiguration> listByResourceGroup(String resourceGroupName) {
        PagedIterable<MaintenanceConfigurationInner> inner =
            this.serviceClient().listByResourceGroup(resourceGroupName);
        return Utils.mapPage(inner, inner1 -> new MaintenanceConfigurationImpl(inner1, this.manager()));
    }

    public PagedIterable<MaintenanceConfiguration> listByResourceGroup(String resourceGroupName, Context context) {
        PagedIterable<MaintenanceConfigurationInner> inner =
            this.serviceClient().listByResourceGroup(resourceGroupName, context);
        return Utils.mapPage(inner, inner1 -> new MaintenanceConfigurationImpl(inner1, this.manager()));
    }

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

    private com.azure.resourcemanager.maintenance.MaintenanceManager manager() {
        return this.serviceManager;
    }
}
