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

package com.azure.resourcemanager.elastic.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.elastic.fluent.ElasticVersionsClient;
import com.azure.resourcemanager.elastic.fluent.models.ElasticVersionListFormatInner;
import com.azure.resourcemanager.elastic.models.ElasticVersionListFormat;
import com.azure.resourcemanager.elastic.models.ElasticVersions;

public final class ElasticVersionsImpl implements ElasticVersions {
    private static final ClientLogger LOGGER = new ClientLogger(ElasticVersionsImpl.class);

    private final ElasticVersionsClient innerClient;

    private final com.azure.resourcemanager.elastic.ElasticManager serviceManager;

    public ElasticVersionsImpl(
        ElasticVersionsClient innerClient, com.azure.resourcemanager.elastic.ElasticManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public PagedIterable<ElasticVersionListFormat> list(String region) {
        PagedIterable<ElasticVersionListFormatInner> inner = this.serviceClient().list(region);
        return Utils.mapPage(inner, inner1 -> new ElasticVersionListFormatImpl(inner1, this.manager()));
    }

    public PagedIterable<ElasticVersionListFormat> list(String region, Context context) {
        PagedIterable<ElasticVersionListFormatInner> inner = this.serviceClient().list(region, context);
        return Utils.mapPage(inner, inner1 -> new ElasticVersionListFormatImpl(inner1, this.manager()));
    }

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

    private com.azure.resourcemanager.elastic.ElasticManager manager() {
        return this.serviceManager;
    }
}
