// 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.resourcemanager.securityinsights.fluent.models.EntityInner;
import com.azure.resourcemanager.securityinsights.fluent.models.IncidentEntitiesResponseInner;
import com.azure.resourcemanager.securityinsights.models.Entity;
import com.azure.resourcemanager.securityinsights.models.IncidentEntitiesResponse;
import com.azure.resourcemanager.securityinsights.models.IncidentEntitiesResultsMetadata;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

public final class IncidentEntitiesResponseImpl implements IncidentEntitiesResponse {
    private IncidentEntitiesResponseInner innerObject;

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

    IncidentEntitiesResponseImpl(
        IncidentEntitiesResponseInner innerObject,
        com.azure.resourcemanager.securityinsights.SecurityInsightsManager serviceManager) {
        this.innerObject = innerObject;
        this.serviceManager = serviceManager;
    }

    public List<Entity> entities() {
        List<EntityInner> inner = this.innerModel().entities();
        if (inner != null) {
            return Collections
                .unmodifiableList(
                    inner.stream().map(inner1 -> new EntityImpl(inner1, this.manager())).collect(Collectors.toList()));
        } else {
            return Collections.emptyList();
        }
    }

    public List<IncidentEntitiesResultsMetadata> metadata() {
        List<IncidentEntitiesResultsMetadata> inner = this.innerModel().metadata();
        if (inner != null) {
            return Collections.unmodifiableList(inner);
        } else {
            return Collections.emptyList();
        }
    }

    public IncidentEntitiesResponseInner innerModel() {
        return this.innerObject;
    }

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