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

package com.azure.resourcemanager.devhub.implementation;

import com.azure.resourcemanager.devhub.fluent.models.GitHubOAuthListResponseInner;
import com.azure.resourcemanager.devhub.fluent.models.GitHubOAuthResponseInner;
import com.azure.resourcemanager.devhub.models.GitHubOAuthListResponse;
import com.azure.resourcemanager.devhub.models.GitHubOAuthResponse;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

public final class GitHubOAuthListResponseImpl implements GitHubOAuthListResponse {
    private GitHubOAuthListResponseInner innerObject;

    private final com.azure.resourcemanager.devhub.DevHubManager serviceManager;

    GitHubOAuthListResponseImpl(
        GitHubOAuthListResponseInner innerObject, com.azure.resourcemanager.devhub.DevHubManager serviceManager) {
        this.innerObject = innerObject;
        this.serviceManager = serviceManager;
    }

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

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

    private com.azure.resourcemanager.devhub.DevHubManager manager() {
        return this.serviceManager;
    }
}
