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

package com.azure.resourcemanager.billing.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.billing.fluent.TransactionsClient;
import com.azure.resourcemanager.billing.fluent.models.TransactionInner;
import com.azure.resourcemanager.billing.models.Transaction;
import com.azure.resourcemanager.billing.models.Transactions;

public final class TransactionsImpl implements Transactions {
    private static final ClientLogger LOGGER = new ClientLogger(TransactionsImpl.class);

    private final TransactionsClient innerClient;

    private final com.azure.resourcemanager.billing.BillingManager serviceManager;

    public TransactionsImpl(
        TransactionsClient innerClient, com.azure.resourcemanager.billing.BillingManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public PagedIterable<Transaction> listByInvoice(String billingAccountName, String invoiceName) {
        PagedIterable<TransactionInner> inner = this.serviceClient().listByInvoice(billingAccountName, invoiceName);
        return Utils.mapPage(inner, inner1 -> new TransactionImpl(inner1, this.manager()));
    }

    public PagedIterable<Transaction> listByInvoice(String billingAccountName, String invoiceName, Context context) {
        PagedIterable<TransactionInner> inner =
            this.serviceClient().listByInvoice(billingAccountName, invoiceName, context);
        return Utils.mapPage(inner, inner1 -> new TransactionImpl(inner1, this.manager()));
    }

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

    private com.azure.resourcemanager.billing.BillingManager manager() {
        return this.serviceManager;
    }
}
