// 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.ReturnsClient;
import com.azure.resourcemanager.reservations.fluent.models.ReservationOrderResponseInner;
import com.azure.resourcemanager.reservations.models.RefundRequest;
import com.azure.resourcemanager.reservations.models.ReservationOrderResponse;
import com.azure.resourcemanager.reservations.models.Returns;

public final class ReturnsImpl implements Returns {
    private static final ClientLogger LOGGER = new ClientLogger(ReturnsImpl.class);

    private final ReturnsClient innerClient;

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

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

    public ReservationOrderResponse post(String reservationOrderId, RefundRequest body) {
        ReservationOrderResponseInner inner = this.serviceClient().post(reservationOrderId, body);
        if (inner != null) {
            return new ReservationOrderResponseImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public ReservationOrderResponse post(String reservationOrderId, RefundRequest body, Context context) {
        ReservationOrderResponseInner inner = this.serviceClient().post(reservationOrderId, body, context);
        if (inner != null) {
            return new ReservationOrderResponseImpl(inner, this.manager());
        } else {
            return null;
        }
    }

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

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