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

package com.azure.resourcemanager.resourcehealth.implementation;

import com.azure.core.http.rest.PagedIterable;
import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.resourcehealth.fluent.EventsOperationsClient;
import com.azure.resourcemanager.resourcehealth.fluent.models.EventInner;
import com.azure.resourcemanager.resourcehealth.models.Event;
import com.azure.resourcemanager.resourcehealth.models.EventsOperations;

public final class EventsOperationsImpl implements EventsOperations {
    private static final ClientLogger LOGGER = new ClientLogger(EventsOperationsImpl.class);

    private final EventsOperationsClient innerClient;

    private final com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager;

    public EventsOperationsImpl(
        EventsOperationsClient innerClient,
        com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public PagedIterable<Event> list() {
        PagedIterable<EventInner> inner = this.serviceClient().list();
        return Utils.mapPage(inner, inner1 -> new EventImpl(inner1, this.manager()));
    }

    public PagedIterable<Event> list(String filter, String queryStartTime, Context context) {
        PagedIterable<EventInner> inner = this.serviceClient().list(filter, queryStartTime, context);
        return Utils.mapPage(inner, inner1 -> new EventImpl(inner1, this.manager()));
    }

    public PagedIterable<Event> listByTenantId() {
        PagedIterable<EventInner> inner = this.serviceClient().listByTenantId();
        return Utils.mapPage(inner, inner1 -> new EventImpl(inner1, this.manager()));
    }

    public PagedIterable<Event> listByTenantId(String filter, String queryStartTime, Context context) {
        PagedIterable<EventInner> inner = this.serviceClient().listByTenantId(filter, queryStartTime, context);
        return Utils.mapPage(inner, inner1 -> new EventImpl(inner1, this.manager()));
    }

    public PagedIterable<Event> listBySingleResource(String resourceUri) {
        PagedIterable<EventInner> inner = this.serviceClient().listBySingleResource(resourceUri);
        return Utils.mapPage(inner, inner1 -> new EventImpl(inner1, this.manager()));
    }

    public PagedIterable<Event> listBySingleResource(String resourceUri, String filter, Context context) {
        PagedIterable<EventInner> inner = this.serviceClient().listBySingleResource(resourceUri, filter, context);
        return Utils.mapPage(inner, inner1 -> new EventImpl(inner1, this.manager()));
    }

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

    private com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager() {
        return this.serviceManager;
    }
}
