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

package com.azure.resourcemanager.customerinsights.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.customerinsights.fluent.RolesClient;
import com.azure.resourcemanager.customerinsights.fluent.models.RoleResourceFormatInner;
import com.azure.resourcemanager.customerinsights.models.RoleResourceFormat;
import com.azure.resourcemanager.customerinsights.models.Roles;

public final class RolesImpl implements Roles {
    private static final ClientLogger LOGGER = new ClientLogger(RolesImpl.class);

    private final RolesClient innerClient;

    private final com.azure.resourcemanager.customerinsights.CustomerInsightsManager serviceManager;

    public RolesImpl(
        RolesClient innerClient, com.azure.resourcemanager.customerinsights.CustomerInsightsManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public PagedIterable<RoleResourceFormat> listByHub(String resourceGroupName, String hubName) {
        PagedIterable<RoleResourceFormatInner> inner = this.serviceClient().listByHub(resourceGroupName, hubName);
        return Utils.mapPage(inner, inner1 -> new RoleResourceFormatImpl(inner1, this.manager()));
    }

    public PagedIterable<RoleResourceFormat> listByHub(String resourceGroupName, String hubName, Context context) {
        PagedIterable<RoleResourceFormatInner> inner =
            this.serviceClient().listByHub(resourceGroupName, hubName, context);
        return Utils.mapPage(inner, inner1 -> new RoleResourceFormatImpl(inner1, this.manager()));
    }

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

    private com.azure.resourcemanager.customerinsights.CustomerInsightsManager manager() {
        return this.serviceManager;
    }
}
