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

package com.azure.resourcemanager.peering.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.peering.fluent.CdnPeeringPrefixesClient;
import com.azure.resourcemanager.peering.fluent.models.CdnPeeringPrefixInner;
import com.azure.resourcemanager.peering.models.CdnPeeringPrefix;
import com.azure.resourcemanager.peering.models.CdnPeeringPrefixes;

public final class CdnPeeringPrefixesImpl implements CdnPeeringPrefixes {
    private static final ClientLogger LOGGER = new ClientLogger(CdnPeeringPrefixesImpl.class);

    private final CdnPeeringPrefixesClient innerClient;

    private final com.azure.resourcemanager.peering.PeeringManager serviceManager;

    public CdnPeeringPrefixesImpl(
        CdnPeeringPrefixesClient innerClient, com.azure.resourcemanager.peering.PeeringManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public PagedIterable<CdnPeeringPrefix> list(String peeringLocation) {
        PagedIterable<CdnPeeringPrefixInner> inner = this.serviceClient().list(peeringLocation);
        return Utils.mapPage(inner, inner1 -> new CdnPeeringPrefixImpl(inner1, this.manager()));
    }

    public PagedIterable<CdnPeeringPrefix> list(String peeringLocation, Context context) {
        PagedIterable<CdnPeeringPrefixInner> inner = this.serviceClient().list(peeringLocation, context);
        return Utils.mapPage(inner, inner1 -> new CdnPeeringPrefixImpl(inner1, this.manager()));
    }

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

    private com.azure.resourcemanager.peering.PeeringManager manager() {
        return this.serviceManager;
    }
}
