// 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.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Calculate exchange request properties. */
@Fluent
public final class CalculateExchangeRequestProperties {
    /*
     * List of reservations that are being purchased in this exchange.
     */
    @JsonProperty(value = "reservationsToPurchase")
    private List<PurchaseRequest> reservationsToPurchase;

    /*
     * List of savings plans that are being purchased in this exchange.
     */
    @JsonProperty(value = "savingsPlansToPurchase")
    private List<SavingsPlanPurchaseRequest> savingsPlansToPurchase;

    /*
     * List of reservations that are being returned in this exchange.
     */
    @JsonProperty(value = "reservationsToExchange")
    private List<ReservationToReturn> reservationsToExchange;

    /** Creates an instance of CalculateExchangeRequestProperties class. */
    public CalculateExchangeRequestProperties() {
    }

    /**
     * Get the reservationsToPurchase property: List of reservations that are being purchased in this exchange.
     *
     * @return the reservationsToPurchase value.
     */
    public List<PurchaseRequest> reservationsToPurchase() {
        return this.reservationsToPurchase;
    }

    /**
     * Set the reservationsToPurchase property: List of reservations that are being purchased in this exchange.
     *
     * @param reservationsToPurchase the reservationsToPurchase value to set.
     * @return the CalculateExchangeRequestProperties object itself.
     */
    public CalculateExchangeRequestProperties withReservationsToPurchase(List<PurchaseRequest> reservationsToPurchase) {
        this.reservationsToPurchase = reservationsToPurchase;
        return this;
    }

    /**
     * Get the savingsPlansToPurchase property: List of savings plans that are being purchased in this exchange.
     *
     * @return the savingsPlansToPurchase value.
     */
    public List<SavingsPlanPurchaseRequest> savingsPlansToPurchase() {
        return this.savingsPlansToPurchase;
    }

    /**
     * Set the savingsPlansToPurchase property: List of savings plans that are being purchased in this exchange.
     *
     * @param savingsPlansToPurchase the savingsPlansToPurchase value to set.
     * @return the CalculateExchangeRequestProperties object itself.
     */
    public CalculateExchangeRequestProperties withSavingsPlansToPurchase(
        List<SavingsPlanPurchaseRequest> savingsPlansToPurchase) {
        this.savingsPlansToPurchase = savingsPlansToPurchase;
        return this;
    }

    /**
     * Get the reservationsToExchange property: List of reservations that are being returned in this exchange.
     *
     * @return the reservationsToExchange value.
     */
    public List<ReservationToReturn> reservationsToExchange() {
        return this.reservationsToExchange;
    }

    /**
     * Set the reservationsToExchange property: List of reservations that are being returned in this exchange.
     *
     * @param reservationsToExchange the reservationsToExchange value to set.
     * @return the CalculateExchangeRequestProperties object itself.
     */
    public CalculateExchangeRequestProperties withReservationsToExchange(
        List<ReservationToReturn> reservationsToExchange) {
        this.reservationsToExchange = reservationsToExchange;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (reservationsToPurchase() != null) {
            reservationsToPurchase().forEach(e -> e.validate());
        }
        if (savingsPlansToPurchase() != null) {
            savingsPlansToPurchase().forEach(e -> e.validate());
        }
        if (reservationsToExchange() != null) {
            reservationsToExchange().forEach(e -> e.validate());
        }
    }
}
