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

package com.azure.resourcemanager.costmanagement.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.costmanagement.fluent.DimensionsClient;
import com.azure.resourcemanager.costmanagement.fluent.models.DimensionInner;
import com.azure.resourcemanager.costmanagement.models.Dimension;
import com.azure.resourcemanager.costmanagement.models.Dimensions;
import com.azure.resourcemanager.costmanagement.models.ExternalCloudProviderType;

public final class DimensionsImpl implements Dimensions {
    private static final ClientLogger LOGGER = new ClientLogger(DimensionsImpl.class);

    private final DimensionsClient innerClient;

    private final com.azure.resourcemanager.costmanagement.CostManagementManager serviceManager;

    public DimensionsImpl(
        DimensionsClient innerClient, com.azure.resourcemanager.costmanagement.CostManagementManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public PagedIterable<Dimension> list(String scope) {
        PagedIterable<DimensionInner> inner = this.serviceClient().list(scope);
        return Utils.mapPage(inner, inner1 -> new DimensionImpl(inner1, this.manager()));
    }

    public PagedIterable<Dimension> list(
        String scope, String filter, String expand, String skiptoken, Integer top, Context context) {
        PagedIterable<DimensionInner> inner = this.serviceClient().list(scope, filter, expand, skiptoken, top, context);
        return Utils.mapPage(inner, inner1 -> new DimensionImpl(inner1, this.manager()));
    }

    public PagedIterable<Dimension> byExternalCloudProviderType(
        ExternalCloudProviderType externalCloudProviderType, String externalCloudProviderId) {
        PagedIterable<DimensionInner> inner =
            this.serviceClient().byExternalCloudProviderType(externalCloudProviderType, externalCloudProviderId);
        return Utils.mapPage(inner, inner1 -> new DimensionImpl(inner1, this.manager()));
    }

    public PagedIterable<Dimension> byExternalCloudProviderType(
        ExternalCloudProviderType externalCloudProviderType,
        String externalCloudProviderId,
        String filter,
        String expand,
        String skiptoken,
        Integer top,
        Context context) {
        PagedIterable<DimensionInner> inner =
            this
                .serviceClient()
                .byExternalCloudProviderType(
                    externalCloudProviderType, externalCloudProviderId, filter, expand, skiptoken, top, context);
        return Utils.mapPage(inner, inner1 -> new DimensionImpl(inner1, this.manager()));
    }

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

    private com.azure.resourcemanager.costmanagement.CostManagementManager manager() {
        return this.serviceManager;
    }
}
