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

package com.azure.resourcemanager.recoveryservices.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.recoveryservices.fluent.UsagesClient;
import com.azure.resourcemanager.recoveryservices.fluent.models.VaultUsageInner;
import com.azure.resourcemanager.recoveryservices.models.Usages;
import com.azure.resourcemanager.recoveryservices.models.VaultUsage;

public final class UsagesImpl implements Usages {
    private static final ClientLogger LOGGER = new ClientLogger(UsagesImpl.class);

    private final UsagesClient innerClient;

    private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager;

    public UsagesImpl(
        UsagesClient innerClient, com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public PagedIterable<VaultUsage> listByVaults(String resourceGroupName, String vaultName) {
        PagedIterable<VaultUsageInner> inner = this.serviceClient().listByVaults(resourceGroupName, vaultName);
        return Utils.mapPage(inner, inner1 -> new VaultUsageImpl(inner1, this.manager()));
    }

    public PagedIterable<VaultUsage> listByVaults(String resourceGroupName, String vaultName, Context context) {
        PagedIterable<VaultUsageInner> inner = this.serviceClient().listByVaults(resourceGroupName, vaultName, context);
        return Utils.mapPage(inner, inner1 -> new VaultUsageImpl(inner1, this.manager()));
    }

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

    private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() {
        return this.serviceManager;
    }
}
