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

package com.azure.resourcemanager.synapse.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.synapse.fluent.IntegrationRuntimeObjectMetadatasClient;
import com.azure.resourcemanager.synapse.fluent.models.SsisObjectMetadataListResponseInner;
import com.azure.resourcemanager.synapse.fluent.models.SsisObjectMetadataStatusResponseInner;
import com.azure.resourcemanager.synapse.models.GetSsisObjectMetadataRequest;
import com.azure.resourcemanager.synapse.models.IntegrationRuntimeObjectMetadatas;
import com.azure.resourcemanager.synapse.models.SsisObjectMetadataListResponse;
import com.azure.resourcemanager.synapse.models.SsisObjectMetadataStatusResponse;

public final class IntegrationRuntimeObjectMetadatasImpl implements IntegrationRuntimeObjectMetadatas {
    private static final ClientLogger LOGGER = new ClientLogger(IntegrationRuntimeObjectMetadatasImpl.class);

    private final IntegrationRuntimeObjectMetadatasClient innerClient;

    private final com.azure.resourcemanager.synapse.SynapseManager serviceManager;

    public IntegrationRuntimeObjectMetadatasImpl(
        IntegrationRuntimeObjectMetadatasClient innerClient,
        com.azure.resourcemanager.synapse.SynapseManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public Response<SsisObjectMetadataListResponse> listWithResponse(
        String resourceGroupName,
        String workspaceName,
        String integrationRuntimeName,
        GetSsisObjectMetadataRequest getMetadataRequest,
        Context context) {
        Response<SsisObjectMetadataListResponseInner> inner =
            this
                .serviceClient()
                .listWithResponse(
                    resourceGroupName, workspaceName, integrationRuntimeName, getMetadataRequest, context);
        if (inner != null) {
            return new SimpleResponse<>(
                inner.getRequest(),
                inner.getStatusCode(),
                inner.getHeaders(),
                new SsisObjectMetadataListResponseImpl(inner.getValue(), this.manager()));
        } else {
            return null;
        }
    }

    public SsisObjectMetadataListResponse list(
        String resourceGroupName, String workspaceName, String integrationRuntimeName) {
        SsisObjectMetadataListResponseInner inner =
            this.serviceClient().list(resourceGroupName, workspaceName, integrationRuntimeName);
        if (inner != null) {
            return new SsisObjectMetadataListResponseImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public SsisObjectMetadataStatusResponse refresh(
        String resourceGroupName, String workspaceName, String integrationRuntimeName) {
        SsisObjectMetadataStatusResponseInner inner =
            this.serviceClient().refresh(resourceGroupName, workspaceName, integrationRuntimeName);
        if (inner != null) {
            return new SsisObjectMetadataStatusResponseImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public SsisObjectMetadataStatusResponse refresh(
        String resourceGroupName, String workspaceName, String integrationRuntimeName, Context context) {
        SsisObjectMetadataStatusResponseInner inner =
            this.serviceClient().refresh(resourceGroupName, workspaceName, integrationRuntimeName, context);
        if (inner != null) {
            return new SsisObjectMetadataStatusResponseImpl(inner, this.manager());
        } else {
            return null;
        }
    }

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

    private com.azure.resourcemanager.synapse.SynapseManager manager() {
        return this.serviceManager;
    }
}
