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

package com.azure.resourcemanager.security.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.security.fluent.ApiCollectionOnboardingsClient;
import com.azure.resourcemanager.security.fluent.models.ApiCollectionResponseInner;
import com.azure.resourcemanager.security.models.ApiCollectionOnboardings;
import com.azure.resourcemanager.security.models.ApiCollectionResponse;

public final class ApiCollectionOnboardingsImpl implements ApiCollectionOnboardings {
    private static final ClientLogger LOGGER = new ClientLogger(ApiCollectionOnboardingsImpl.class);

    private final ApiCollectionOnboardingsClient innerClient;

    private final com.azure.resourcemanager.security.SecurityManager serviceManager;

    public ApiCollectionOnboardingsImpl(
        ApiCollectionOnboardingsClient innerClient, com.azure.resourcemanager.security.SecurityManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public Response<ApiCollectionResponse> createWithResponse(
        String resourceGroupName, String serviceName, String apiCollectionId, Context context) {
        Response<ApiCollectionResponseInner> inner =
            this.serviceClient().createWithResponse(resourceGroupName, serviceName, apiCollectionId, context);
        if (inner != null) {
            return new SimpleResponse<>(
                inner.getRequest(),
                inner.getStatusCode(),
                inner.getHeaders(),
                new ApiCollectionResponseImpl(inner.getValue(), this.manager()));
        } else {
            return null;
        }
    }

    public ApiCollectionResponse create(String resourceGroupName, String serviceName, String apiCollectionId) {
        ApiCollectionResponseInner inner = this.serviceClient().create(resourceGroupName, serviceName, apiCollectionId);
        if (inner != null) {
            return new ApiCollectionResponseImpl(inner, this.manager());
        } else {
            return null;
        }
    }

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

    private com.azure.resourcemanager.security.SecurityManager manager() {
        return this.serviceManager;
    }
}
