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

package com.azure.resourcemanager.healthcareapis.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.healthcareapis.fluent.FhirDestinationsClient;
import com.azure.resourcemanager.healthcareapis.fluent.models.IotFhirDestinationInner;
import com.azure.resourcemanager.healthcareapis.models.FhirDestinations;
import com.azure.resourcemanager.healthcareapis.models.IotFhirDestination;

public final class FhirDestinationsImpl implements FhirDestinations {
    private static final ClientLogger LOGGER = new ClientLogger(FhirDestinationsImpl.class);

    private final FhirDestinationsClient innerClient;

    private final com.azure.resourcemanager.healthcareapis.HealthcareApisManager serviceManager;

    public FhirDestinationsImpl(
        FhirDestinationsClient innerClient,
        com.azure.resourcemanager.healthcareapis.HealthcareApisManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public PagedIterable<IotFhirDestination> listByIotConnector(
        String resourceGroupName, String workspaceName, String iotConnectorName) {
        PagedIterable<IotFhirDestinationInner> inner =
            this.serviceClient().listByIotConnector(resourceGroupName, workspaceName, iotConnectorName);
        return Utils.mapPage(inner, inner1 -> new IotFhirDestinationImpl(inner1, this.manager()));
    }

    public PagedIterable<IotFhirDestination> listByIotConnector(
        String resourceGroupName, String workspaceName, String iotConnectorName, Context context) {
        PagedIterable<IotFhirDestinationInner> inner =
            this.serviceClient().listByIotConnector(resourceGroupName, workspaceName, iotConnectorName, context);
        return Utils.mapPage(inner, inner1 -> new IotFhirDestinationImpl(inner1, this.manager()));
    }

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

    private com.azure.resourcemanager.healthcareapis.HealthcareApisManager manager() {
        return this.serviceManager;
    }
}
