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

package com.azure.resourcemanager.consumption.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.consumption.fluent.TagsClient;
import com.azure.resourcemanager.consumption.fluent.models.TagsResultInner;
import com.azure.resourcemanager.consumption.models.Tags;
import com.azure.resourcemanager.consumption.models.TagsResult;
import com.fasterxml.jackson.annotation.JsonIgnore;

public final class TagsImpl implements Tags {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(TagsImpl.class);

    private final TagsClient innerClient;

    private final com.azure.resourcemanager.consumption.ConsumptionManager serviceManager;

    public TagsImpl(TagsClient innerClient, com.azure.resourcemanager.consumption.ConsumptionManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public TagsResult get(String scope) {
        TagsResultInner inner = this.serviceClient().get(scope);
        if (inner != null) {
            return new TagsResultImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public Response<TagsResult> getWithResponse(String scope, Context context) {
        Response<TagsResultInner> inner = this.serviceClient().getWithResponse(scope, context);
        if (inner != null) {
            return new SimpleResponse<>(
                inner.getRequest(),
                inner.getStatusCode(),
                inner.getHeaders(),
                new TagsResultImpl(inner.getValue(), this.manager()));
        } else {
            return null;
        }
    }

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

    private com.azure.resourcemanager.consumption.ConsumptionManager manager() {
        return this.serviceManager;
    }
}
