// 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.ReportOperationsClient;
import com.azure.resourcemanager.appcomplianceautomation.fluent.models.ReportResourceInner;
import com.azure.resourcemanager.appcomplianceautomation.models.ReportOperations;
import com.azure.resourcemanager.appcomplianceautomation.models.ReportResource;
import com.azure.resourcemanager.appcomplianceautomation.models.ReportResourcePatch;

public final class ReportOperationsImpl implements ReportOperations {
    private static final ClientLogger LOGGER = new ClientLogger(ReportOperationsImpl.class);

    private final ReportOperationsClient innerClient;

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

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

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

    public ReportResource get(String reportName) {
        ReportResourceInner inner = this.serviceClient().get(reportName);
        if (inner != null) {
            return new ReportResourceImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public ReportResource createOrUpdate(String reportName, ReportResourceInner parameters) {
        ReportResourceInner inner = this.serviceClient().createOrUpdate(reportName, parameters);
        if (inner != null) {
            return new ReportResourceImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public ReportResource createOrUpdate(String reportName, ReportResourceInner parameters, Context context) {
        ReportResourceInner inner = this.serviceClient().createOrUpdate(reportName, parameters, context);
        if (inner != null) {
            return new ReportResourceImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public ReportResource update(String reportName, ReportResourcePatch parameters) {
        ReportResourceInner inner = this.serviceClient().update(reportName, parameters);
        if (inner != null) {
            return new ReportResourceImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public ReportResource update(String reportName, ReportResourcePatch parameters, Context context) {
        ReportResourceInner inner = this.serviceClient().update(reportName, parameters, context);
        if (inner != null) {
            return new ReportResourceImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public void delete(String reportName) {
        this.serviceClient().delete(reportName);
    }

    public void delete(String reportName, Context context) {
        this.serviceClient().delete(reportName, context);
    }

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

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