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

package com.azure.resourcemanager.delegatednetwork.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.delegatednetwork.fluent.DelegatedNetworksClient;
import com.azure.resourcemanager.delegatednetwork.fluent.models.DelegatedControllerInner;
import com.azure.resourcemanager.delegatednetwork.models.DelegatedController;
import com.azure.resourcemanager.delegatednetwork.models.DelegatedNetworks;

public final class DelegatedNetworksImpl implements DelegatedNetworks {
    private static final ClientLogger LOGGER = new ClientLogger(DelegatedNetworksImpl.class);

    private final DelegatedNetworksClient innerClient;

    private final com.azure.resourcemanager.delegatednetwork.DelegatedNetworkManager serviceManager;

    public DelegatedNetworksImpl(
        DelegatedNetworksClient innerClient,
        com.azure.resourcemanager.delegatednetwork.DelegatedNetworkManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public PagedIterable<DelegatedController> list() {
        PagedIterable<DelegatedControllerInner> inner = this.serviceClient().list();
        return Utils.mapPage(inner, inner1 -> new DelegatedControllerImpl(inner1, this.manager()));
    }

    public PagedIterable<DelegatedController> list(Context context) {
        PagedIterable<DelegatedControllerInner> inner = this.serviceClient().list(context);
        return Utils.mapPage(inner, inner1 -> new DelegatedControllerImpl(inner1, this.manager()));
    }

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

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

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

    private com.azure.resourcemanager.delegatednetwork.DelegatedNetworkManager manager() {
        return this.serviceManager;
    }
}
