// 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.PeeringLocationsClient;
import com.azure.resourcemanager.peering.fluent.models.PeeringLocationInner;
import com.azure.resourcemanager.peering.models.PeeringLocation;
import com.azure.resourcemanager.peering.models.PeeringLocations;
import com.azure.resourcemanager.peering.models.PeeringLocationsDirectPeeringType;
import com.azure.resourcemanager.peering.models.PeeringLocationsKind;

public final class PeeringLocationsImpl implements PeeringLocations {
    private static final ClientLogger LOGGER = new ClientLogger(PeeringLocationsImpl.class);

    private final PeeringLocationsClient innerClient;

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

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

    public PagedIterable<PeeringLocation> list(PeeringLocationsKind kind) {
        PagedIterable<PeeringLocationInner> inner = this.serviceClient().list(kind);
        return Utils.mapPage(inner, inner1 -> new PeeringLocationImpl(inner1, this.manager()));
    }

    public PagedIterable<PeeringLocation> list(
        PeeringLocationsKind kind, PeeringLocationsDirectPeeringType directPeeringType, Context context) {
        PagedIterable<PeeringLocationInner> inner = this.serviceClient().list(kind, directPeeringType, context);
        return Utils.mapPage(inner, inner1 -> new PeeringLocationImpl(inner1, this.manager()));
    }

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

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