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

package com.azure.resourcemanager.commerce.implementation;

import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.SimpleResponse;
import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.commerce.fluent.RateCardsClient;
import com.azure.resourcemanager.commerce.fluent.models.ResourceRateCardInfoInner;
import com.azure.resourcemanager.commerce.models.RateCards;
import com.azure.resourcemanager.commerce.models.ResourceRateCardInfo;

public final class RateCardsImpl implements RateCards {
    private static final ClientLogger LOGGER = new ClientLogger(RateCardsImpl.class);

    private final RateCardsClient innerClient;

    private final com.azure.resourcemanager.commerce.UsageManager serviceManager;

    public RateCardsImpl(RateCardsClient innerClient, com.azure.resourcemanager.commerce.UsageManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public Response<ResourceRateCardInfo> getWithResponse(String filter, Context context) {
        Response<ResourceRateCardInfoInner> inner = this.serviceClient().getWithResponse(filter, context);
        if (inner != null) {
            return new SimpleResponse<>(
                inner.getRequest(),
                inner.getStatusCode(),
                inner.getHeaders(),
                new ResourceRateCardInfoImpl(inner.getValue(), this.manager()));
        } else {
            return null;
        }
    }

    public ResourceRateCardInfo get(String filter) {
        ResourceRateCardInfoInner inner = this.serviceClient().get(filter);
        if (inner != null) {
            return new ResourceRateCardInfoImpl(inner, this.manager());
        } else {
            return null;
        }
    }

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

    private com.azure.resourcemanager.commerce.UsageManager manager() {
        return this.serviceManager;
    }
}
