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

package com.azure.resourcemanager.recoveryservices.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.recoveryservices.fluent.VaultExtendedInfoesClient;
import com.azure.resourcemanager.recoveryservices.fluent.models.VaultExtendedInfoResourceInner;
import com.azure.resourcemanager.recoveryservices.models.VaultExtendedInfoResource;
import com.azure.resourcemanager.recoveryservices.models.VaultExtendedInfoes;

public final class VaultExtendedInfoesImpl implements VaultExtendedInfoes {
    private static final ClientLogger LOGGER = new ClientLogger(VaultExtendedInfoesImpl.class);

    private final VaultExtendedInfoesClient innerClient;

    private final com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager;

    public VaultExtendedInfoesImpl(
        VaultExtendedInfoesClient innerClient,
        com.azure.resourcemanager.recoveryservices.RecoveryServicesManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

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

    public VaultExtendedInfoResource get(String resourceGroupName, String vaultName) {
        VaultExtendedInfoResourceInner inner = this.serviceClient().get(resourceGroupName, vaultName);
        if (inner != null) {
            return new VaultExtendedInfoResourceImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public Response<VaultExtendedInfoResource> createOrUpdateWithResponse(
        String resourceGroupName,
        String vaultName,
        VaultExtendedInfoResourceInner resourceExtendedInfoDetails,
        Context context) {
        Response<VaultExtendedInfoResourceInner> inner =
            this
                .serviceClient()
                .createOrUpdateWithResponse(resourceGroupName, vaultName, resourceExtendedInfoDetails, context);
        if (inner != null) {
            return new SimpleResponse<>(
                inner.getRequest(),
                inner.getStatusCode(),
                inner.getHeaders(),
                new VaultExtendedInfoResourceImpl(inner.getValue(), this.manager()));
        } else {
            return null;
        }
    }

    public VaultExtendedInfoResource createOrUpdate(
        String resourceGroupName, String vaultName, VaultExtendedInfoResourceInner resourceExtendedInfoDetails) {
        VaultExtendedInfoResourceInner inner =
            this.serviceClient().createOrUpdate(resourceGroupName, vaultName, resourceExtendedInfoDetails);
        if (inner != null) {
            return new VaultExtendedInfoResourceImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public Response<VaultExtendedInfoResource> updateWithResponse(
        String resourceGroupName,
        String vaultName,
        VaultExtendedInfoResourceInner resourceExtendedInfoDetails,
        Context context) {
        Response<VaultExtendedInfoResourceInner> inner =
            this.serviceClient().updateWithResponse(resourceGroupName, vaultName, resourceExtendedInfoDetails, context);
        if (inner != null) {
            return new SimpleResponse<>(
                inner.getRequest(),
                inner.getStatusCode(),
                inner.getHeaders(),
                new VaultExtendedInfoResourceImpl(inner.getValue(), this.manager()));
        } else {
            return null;
        }
    }

    public VaultExtendedInfoResource update(
        String resourceGroupName, String vaultName, VaultExtendedInfoResourceInner resourceExtendedInfoDetails) {
        VaultExtendedInfoResourceInner inner =
            this.serviceClient().update(resourceGroupName, vaultName, resourceExtendedInfoDetails);
        if (inner != null) {
            return new VaultExtendedInfoResourceImpl(inner, this.manager());
        } else {
            return null;
        }
    }

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

    private com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager() {
        return this.serviceManager;
    }
}
