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

package com.azure.resourcemanager.securityinsights.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.securityinsights.fluent.EntitiesRelationsClient;
import com.azure.resourcemanager.securityinsights.fluent.models.RelationInner;
import com.azure.resourcemanager.securityinsights.models.EntitiesRelations;
import com.azure.resourcemanager.securityinsights.models.Relation;

public final class EntitiesRelationsImpl implements EntitiesRelations {
    private static final ClientLogger LOGGER = new ClientLogger(EntitiesRelationsImpl.class);

    private final EntitiesRelationsClient innerClient;

    private final com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager;

    public EntitiesRelationsImpl(
        EntitiesRelationsClient innerClient,
        com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public PagedIterable<Relation> list(String resourceGroupName, String workspaceName, String entityId) {
        PagedIterable<RelationInner> inner = this.serviceClient().list(resourceGroupName, workspaceName, entityId);
        return Utils.mapPage(inner, inner1 -> new RelationImpl(inner1, this.manager()));
    }

    public PagedIterable<Relation> list(
        String resourceGroupName,
        String workspaceName,
        String entityId,
        String filter,
        String orderby,
        Integer top,
        String skipToken,
        Context context) {
        PagedIterable<RelationInner> inner =
            this
                .serviceClient()
                .list(resourceGroupName, workspaceName, entityId, filter, orderby, top, skipToken, context);
        return Utils.mapPage(inner, inner1 -> new RelationImpl(inner1, this.manager()));
    }

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

    private com.azure.resourcemanager.securityinsights.SecurityInsightsManager manager() {
        return this.serviceManager;
    }
}
