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

package com.azure.resourcemanager.reservations.implementation;

import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.reservations.fluent.ExchangesClient;
import com.azure.resourcemanager.reservations.fluent.models.ExchangeOperationResultResponseInner;
import com.azure.resourcemanager.reservations.models.ExchangeOperationResultResponse;
import com.azure.resourcemanager.reservations.models.ExchangeRequest;
import com.azure.resourcemanager.reservations.models.Exchanges;

public final class ExchangesImpl implements Exchanges {
    private static final ClientLogger LOGGER = new ClientLogger(ExchangesImpl.class);

    private final ExchangesClient innerClient;

    private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager;

    public ExchangesImpl(
        ExchangesClient innerClient, com.azure.resourcemanager.reservations.ReservationsManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public ExchangeOperationResultResponse post(ExchangeRequest body) {
        ExchangeOperationResultResponseInner inner = this.serviceClient().post(body);
        if (inner != null) {
            return new ExchangeOperationResultResponseImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public ExchangeOperationResultResponse post(ExchangeRequest body, Context context) {
        ExchangeOperationResultResponseInner inner = this.serviceClient().post(body, context);
        if (inner != null) {
            return new ExchangeOperationResultResponseImpl(inner, this.manager());
        } else {
            return null;
        }
    }

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

    private com.azure.resourcemanager.reservations.ReservationsManager manager() {
        return this.serviceManager;
    }
}
