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

package com.azure.resourcemanager.securityinsights.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.securityinsights.fluent.DataConnectorsCheckRequirementsOperationsClient;
import com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorRequirementsStateInner;
import com.azure.resourcemanager.securityinsights.models.DataConnectorRequirementsState;
import com.azure.resourcemanager.securityinsights.models.DataConnectorsCheckRequirements;
import com.azure.resourcemanager.securityinsights.models.DataConnectorsCheckRequirementsOperations;

public final class DataConnectorsCheckRequirementsOperationsImpl implements DataConnectorsCheckRequirementsOperations {
    private static final ClientLogger LOGGER = new ClientLogger(DataConnectorsCheckRequirementsOperationsImpl.class);

    private final DataConnectorsCheckRequirementsOperationsClient innerClient;

    private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager;

    public DataConnectorsCheckRequirementsOperationsImpl(
        DataConnectorsCheckRequirementsOperationsClient innerClient,
        com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public DataConnectorRequirementsState post(
        String resourceGroupName,
        String workspaceName,
        DataConnectorsCheckRequirements dataConnectorsCheckRequirements) {
        DataConnectorRequirementsStateInner inner =
            this.serviceClient().post(resourceGroupName, workspaceName, dataConnectorsCheckRequirements);
        if (inner != null) {
            return new DataConnectorRequirementsStateImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public Response<DataConnectorRequirementsState> postWithResponse(
        String resourceGroupName,
        String workspaceName,
        DataConnectorsCheckRequirements dataConnectorsCheckRequirements,
        Context context) {
        Response<DataConnectorRequirementsStateInner> inner =
            this
                .serviceClient()
                .postWithResponse(resourceGroupName, workspaceName, dataConnectorsCheckRequirements, context);
        if (inner != null) {
            return new SimpleResponse<>(
                inner.getRequest(),
                inner.getStatusCode(),
                inner.getHeaders(),
                new DataConnectorRequirementsStateImpl(inner.getValue(), this.manager()));
        } else {
            return null;
        }
    }

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

    private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() {
        return this.serviceManager;
    }
}
