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

package com.azure.resourcemanager.securitydevops.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.securitydevops.fluent.AzureDevOpsConnectorStatsOperationsClient;
import com.azure.resourcemanager.securitydevops.fluent.models.AzureDevOpsConnectorStatsListResponseInner;
import com.azure.resourcemanager.securitydevops.models.AzureDevOpsConnectorStatsListResponse;
import com.azure.resourcemanager.securitydevops.models.AzureDevOpsConnectorStatsOperations;

public final class AzureDevOpsConnectorStatsOperationsImpl implements AzureDevOpsConnectorStatsOperations {
    private static final ClientLogger LOGGER = new ClientLogger(AzureDevOpsConnectorStatsOperationsImpl.class);

    private final AzureDevOpsConnectorStatsOperationsClient innerClient;

    private final com.azure.resourcemanager.securitydevops.SecurityDevOpsManager serviceManager;

    public AzureDevOpsConnectorStatsOperationsImpl(
        AzureDevOpsConnectorStatsOperationsClient innerClient,
        com.azure.resourcemanager.securitydevops.SecurityDevOpsManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public Response<AzureDevOpsConnectorStatsListResponse> getWithResponse(
        String resourceGroupName, String azureDevOpsConnectorName, Context context) {
        Response<AzureDevOpsConnectorStatsListResponseInner> inner =
            this.serviceClient().getWithResponse(resourceGroupName, azureDevOpsConnectorName, context);
        if (inner != null) {
            return new SimpleResponse<>(
                inner.getRequest(),
                inner.getStatusCode(),
                inner.getHeaders(),
                new AzureDevOpsConnectorStatsListResponseImpl(inner.getValue(), this.manager()));
        } else {
            return null;
        }
    }

    public AzureDevOpsConnectorStatsListResponse get(String resourceGroupName, String azureDevOpsConnectorName) {
        AzureDevOpsConnectorStatsListResponseInner inner =
            this.serviceClient().get(resourceGroupName, azureDevOpsConnectorName);
        if (inner != null) {
            return new AzureDevOpsConnectorStatsListResponseImpl(inner, this.manager());
        } else {
            return null;
        }
    }

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

    private com.azure.resourcemanager.securitydevops.SecurityDevOpsManager manager() {
        return this.serviceManager;
    }
}
