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

package com.azure.resourcemanager.mariadb.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.mariadb.fluent.LocationBasedRecommendedActionSessionsOperationStatusClient;
import com.azure.resourcemanager.mariadb.fluent.models.RecommendedActionSessionsOperationStatusInner;
import com.azure.resourcemanager.mariadb.models.LocationBasedRecommendedActionSessionsOperationStatus;
import com.azure.resourcemanager.mariadb.models.RecommendedActionSessionsOperationStatus;

public final class LocationBasedRecommendedActionSessionsOperationStatusImpl
    implements LocationBasedRecommendedActionSessionsOperationStatus {
    private static final ClientLogger LOGGER =
        new ClientLogger(LocationBasedRecommendedActionSessionsOperationStatusImpl.class);

    private final LocationBasedRecommendedActionSessionsOperationStatusClient innerClient;

    private final com.azure.resourcemanager.mariadb.MariaDBManager serviceManager;

    public LocationBasedRecommendedActionSessionsOperationStatusImpl(
        LocationBasedRecommendedActionSessionsOperationStatusClient innerClient,
        com.azure.resourcemanager.mariadb.MariaDBManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public Response<RecommendedActionSessionsOperationStatus> getWithResponse(
        String locationName, String operationId, Context context) {
        Response<RecommendedActionSessionsOperationStatusInner> inner =
            this.serviceClient().getWithResponse(locationName, operationId, context);
        if (inner != null) {
            return new SimpleResponse<>(
                inner.getRequest(),
                inner.getStatusCode(),
                inner.getHeaders(),
                new RecommendedActionSessionsOperationStatusImpl(inner.getValue(), this.manager()));
        } else {
            return null;
        }
    }

    public RecommendedActionSessionsOperationStatus get(String locationName, String operationId) {
        RecommendedActionSessionsOperationStatusInner inner = this.serviceClient().get(locationName, operationId);
        if (inner != null) {
            return new RecommendedActionSessionsOperationStatusImpl(inner, this.manager());
        } else {
            return null;
        }
    }

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

    private com.azure.resourcemanager.mariadb.MariaDBManager manager() {
        return this.serviceManager;
    }
}
