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

package com.azure.resourcemanager.appcomplianceautomation.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.appcomplianceautomation.fluent.SnapshotOperationsClient;
import com.azure.resourcemanager.appcomplianceautomation.fluent.models.DownloadResponseInner;
import com.azure.resourcemanager.appcomplianceautomation.fluent.models.SnapshotResourceInner;
import com.azure.resourcemanager.appcomplianceautomation.models.DownloadResponse;
import com.azure.resourcemanager.appcomplianceautomation.models.SnapshotDownloadRequest;
import com.azure.resourcemanager.appcomplianceautomation.models.SnapshotOperations;
import com.azure.resourcemanager.appcomplianceautomation.models.SnapshotResource;

public final class SnapshotOperationsImpl implements SnapshotOperations {
    private static final ClientLogger LOGGER = new ClientLogger(SnapshotOperationsImpl.class);

    private final SnapshotOperationsClient innerClient;

    private final com.azure.resourcemanager.appcomplianceautomation.AppComplianceAutomationManager serviceManager;

    public SnapshotOperationsImpl(
        SnapshotOperationsClient innerClient,
        com.azure.resourcemanager.appcomplianceautomation.AppComplianceAutomationManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public Response<SnapshotResource> getWithResponse(String reportName, String snapshotName, Context context) {
        Response<SnapshotResourceInner> inner = this.serviceClient().getWithResponse(reportName, snapshotName, context);
        if (inner != null) {
            return new SimpleResponse<>(
                inner.getRequest(),
                inner.getStatusCode(),
                inner.getHeaders(),
                new SnapshotResourceImpl(inner.getValue(), this.manager()));
        } else {
            return null;
        }
    }

    public SnapshotResource get(String reportName, String snapshotName) {
        SnapshotResourceInner inner = this.serviceClient().get(reportName, snapshotName);
        if (inner != null) {
            return new SnapshotResourceImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public DownloadResponse download(String reportName, String snapshotName, SnapshotDownloadRequest parameters) {
        DownloadResponseInner inner = this.serviceClient().download(reportName, snapshotName, parameters);
        if (inner != null) {
            return new DownloadResponseImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public DownloadResponse download(
        String reportName, String snapshotName, SnapshotDownloadRequest parameters, Context context) {
        DownloadResponseInner inner = this.serviceClient().download(reportName, snapshotName, parameters, context);
        if (inner != null) {
            return new DownloadResponseImpl(inner, this.manager());
        } else {
            return null;
        }
    }

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

    private com.azure.resourcemanager.appcomplianceautomation.AppComplianceAutomationManager manager() {
        return this.serviceManager;
    }
}
