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

package tsptest.armcustomization.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 tsptest.armcustomization.fluent.VaultsClient;
import tsptest.armcustomization.fluent.models.VaultInner;
import tsptest.armcustomization.models.Vault;
import tsptest.armcustomization.models.Vaults;

public final class VaultsImpl implements Vaults {
    private static final ClientLogger LOGGER = new ClientLogger(VaultsImpl.class);

    private final VaultsClient innerClient;

    private final tsptest.armcustomization.ArmCustomizationManager serviceManager;

    public VaultsImpl(VaultsClient innerClient, tsptest.armcustomization.ArmCustomizationManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public Response<Vault> getByResourceGroupWithResponse(String resourceGroupName, String vaultName, Context context) {
        Response<VaultInner> inner
            = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, vaultName, context);
        return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
            new VaultImpl(inner.getValue(), this.manager()));
    }

    public Vault getByResourceGroup(String resourceGroupName, String vaultName) {
        VaultInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, vaultName);
        if (inner != null) {
            return new VaultImpl(inner, this.manager());
        } else {
            return null;
        }
    }

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

    private tsptest.armcustomization.ArmCustomizationManager manager() {
        return this.serviceManager;
    }
}
