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

package com.azure.resourcemanager.synapse.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.synapse.fluent.SparkConfigurationsOperationsClient;
import com.azure.resourcemanager.synapse.fluent.models.SparkConfigurationResourceInner;
import com.azure.resourcemanager.synapse.models.SparkConfigurationResource;
import com.azure.resourcemanager.synapse.models.SparkConfigurationsOperations;

public final class SparkConfigurationsOperationsImpl implements SparkConfigurationsOperations {
    private static final ClientLogger LOGGER = new ClientLogger(SparkConfigurationsOperationsImpl.class);

    private final SparkConfigurationsOperationsClient innerClient;

    private final com.azure.resourcemanager.synapse.SynapseManager serviceManager;

    public SparkConfigurationsOperationsImpl(
        SparkConfigurationsOperationsClient innerClient,
        com.azure.resourcemanager.synapse.SynapseManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public PagedIterable<SparkConfigurationResource> listByWorkspace(String resourceGroupName, String workspaceName) {
        PagedIterable<SparkConfigurationResourceInner> inner =
            this.serviceClient().listByWorkspace(resourceGroupName, workspaceName);
        return Utils.mapPage(inner, inner1 -> new SparkConfigurationResourceImpl(inner1, this.manager()));
    }

    public PagedIterable<SparkConfigurationResource> listByWorkspace(
        String resourceGroupName, String workspaceName, Context context) {
        PagedIterable<SparkConfigurationResourceInner> inner =
            this.serviceClient().listByWorkspace(resourceGroupName, workspaceName, context);
        return Utils.mapPage(inner, inner1 -> new SparkConfigurationResourceImpl(inner1, this.manager()));
    }

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

    private com.azure.resourcemanager.synapse.SynapseManager manager() {
        return this.serviceManager;
    }
}
