// 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.LegacyPeeringsClient;
import com.azure.resourcemanager.peering.fluent.models.PeeringInner;
import com.azure.resourcemanager.peering.models.LegacyPeerings;
import com.azure.resourcemanager.peering.models.LegacyPeeringsKind;
import com.azure.resourcemanager.peering.models.Peering;

public final class LegacyPeeringsImpl implements LegacyPeerings {
    private static final ClientLogger LOGGER = new ClientLogger(LegacyPeeringsImpl.class);

    private final LegacyPeeringsClient innerClient;

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

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

    public PagedIterable<Peering> list(String peeringLocation, LegacyPeeringsKind kind) {
        PagedIterable<PeeringInner> inner = this.serviceClient().list(peeringLocation, kind);
        return Utils.mapPage(inner, inner1 -> new PeeringImpl(inner1, this.manager()));
    }

    public PagedIterable<Peering> list(String peeringLocation, LegacyPeeringsKind kind, Integer asn, Context context) {
        PagedIterable<PeeringInner> inner = this.serviceClient().list(peeringLocation, kind, asn, context);
        return Utils.mapPage(inner, inner1 -> new PeeringImpl(inner1, this.manager()));
    }

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

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