// 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.ReceivedRoutesClient;
import com.azure.resourcemanager.peering.fluent.models.PeeringReceivedRouteInner;
import com.azure.resourcemanager.peering.models.PeeringReceivedRoute;
import com.azure.resourcemanager.peering.models.ReceivedRoutes;

public final class ReceivedRoutesImpl implements ReceivedRoutes {
    private static final ClientLogger LOGGER = new ClientLogger(ReceivedRoutesImpl.class);

    private final ReceivedRoutesClient innerClient;

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

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

    public PagedIterable<PeeringReceivedRoute> listByPeering(String resourceGroupName, String peeringName) {
        PagedIterable<PeeringReceivedRouteInner> inner =
            this.serviceClient().listByPeering(resourceGroupName, peeringName);
        return Utils.mapPage(inner, inner1 -> new PeeringReceivedRouteImpl(inner1, this.manager()));
    }

    public PagedIterable<PeeringReceivedRoute> listByPeering(
        String resourceGroupName,
        String peeringName,
        String prefix,
        String asPath,
        String originAsValidationState,
        String rpkiValidationState,
        String skipToken,
        Context context) {
        PagedIterable<PeeringReceivedRouteInner> inner =
            this
                .serviceClient()
                .listByPeering(
                    resourceGroupName,
                    peeringName,
                    prefix,
                    asPath,
                    originAsValidationState,
                    rpkiValidationState,
                    skipToken,
                    context);
        return Utils.mapPage(inner, inner1 -> new PeeringReceivedRouteImpl(inner1, this.manager()));
    }

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

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