// 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.GitHubConnectorStatsOperationsClient;
import com.azure.resourcemanager.securitydevops.fluent.models.GitHubConnectorStatsListResponseInner;
import com.azure.resourcemanager.securitydevops.models.GitHubConnectorStatsListResponse;
import com.azure.resourcemanager.securitydevops.models.GitHubConnectorStatsOperations;

public final class GitHubConnectorStatsOperationsImpl implements GitHubConnectorStatsOperations {
    private static final ClientLogger LOGGER = new ClientLogger(GitHubConnectorStatsOperationsImpl.class);

    private final GitHubConnectorStatsOperationsClient innerClient;

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

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

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

    public GitHubConnectorStatsListResponse get(String resourceGroupName, String gitHubConnectorName) {
        GitHubConnectorStatsListResponseInner inner = this.serviceClient().get(resourceGroupName, gitHubConnectorName);
        if (inner != null) {
            return new GitHubConnectorStatsListResponseImpl(inner, this.manager());
        } else {
            return null;
        }
    }

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

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