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

package com.azure.resourcemanager.timeseriesinsights.implementation;

import com.azure.resourcemanager.timeseriesinsights.fluent.models.AccessPolicyListResponseInner;
import com.azure.resourcemanager.timeseriesinsights.fluent.models.AccessPolicyResourceInner;
import com.azure.resourcemanager.timeseriesinsights.models.AccessPolicyListResponse;
import com.azure.resourcemanager.timeseriesinsights.models.AccessPolicyResource;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

public final class AccessPolicyListResponseImpl implements AccessPolicyListResponse {
    private AccessPolicyListResponseInner innerObject;

    private final com.azure.resourcemanager.timeseriesinsights.TimeSeriesInsightsManager serviceManager;

    AccessPolicyListResponseImpl(
        AccessPolicyListResponseInner innerObject,
        com.azure.resourcemanager.timeseriesinsights.TimeSeriesInsightsManager serviceManager) {
        this.innerObject = innerObject;
        this.serviceManager = serviceManager;
    }

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

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

    private com.azure.resourcemanager.timeseriesinsights.TimeSeriesInsightsManager manager() {
        return this.serviceManager;
    }
}
