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

package com.azure.resourcemanager.automation.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.automation.fluent.DeletedAutomationAccountsClient;
import com.azure.resourcemanager.automation.fluent.models.DeletedAutomationAccountListResultInner;
import com.azure.resourcemanager.automation.models.DeletedAutomationAccountListResult;
import com.azure.resourcemanager.automation.models.DeletedAutomationAccounts;

public final class DeletedAutomationAccountsImpl implements DeletedAutomationAccounts {
    private static final ClientLogger LOGGER = new ClientLogger(DeletedAutomationAccountsImpl.class);

    private final DeletedAutomationAccountsClient innerClient;

    private final com.azure.resourcemanager.automation.AutomationManager serviceManager;

    public DeletedAutomationAccountsImpl(
        DeletedAutomationAccountsClient innerClient,
        com.azure.resourcemanager.automation.AutomationManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public DeletedAutomationAccountListResult listBySubscription() {
        DeletedAutomationAccountListResultInner inner = this.serviceClient().listBySubscription();
        if (inner != null) {
            return new DeletedAutomationAccountListResultImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public Response<DeletedAutomationAccountListResult> listBySubscriptionWithResponse(Context context) {
        Response<DeletedAutomationAccountListResultInner> inner =
            this.serviceClient().listBySubscriptionWithResponse(context);
        if (inner != null) {
            return new SimpleResponse<>(
                inner.getRequest(),
                inner.getStatusCode(),
                inner.getHeaders(),
                new DeletedAutomationAccountListResultImpl(inner.getValue(), this.manager()));
        } else {
            return null;
        }
    }

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

    private com.azure.resourcemanager.automation.AutomationManager manager() {
        return this.serviceManager;
    }
}
