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

/** CalculateExchange response properties. */
@Fluent
public final class CalculateExchangeResponseProperties {
    /*
     * Exchange session identifier
     */
    @JsonProperty(value = "sessionId")
    private String sessionId;

    /*
     * Pricing information containing the amount and the currency code
     */
    @JsonProperty(value = "netPayable")
    private Price netPayable;

    /*
     * Pricing information containing the amount and the currency code
     */
    @JsonProperty(value = "refundsTotal")
    private Price refundsTotal;

    /*
     * Pricing information containing the amount and the currency code
     */
    @JsonProperty(value = "purchasesTotal")
    private Price purchasesTotal;

    /*
     * Details of the reservations being purchased
     */
    @JsonProperty(value = "reservationsToPurchase")
    private List<ReservationToPurchaseCalculateExchange> reservationsToPurchase;

    /*
     * Details of the savings plans being purchased
     */
    @JsonProperty(value = "savingsPlansToPurchase")
    private List<SavingsPlanToPurchaseCalculateExchange> savingsPlansToPurchase;

    /*
     * Details of the reservations being returned
     */
    @JsonProperty(value = "reservationsToExchange")
    private List<ReservationToExchange> reservationsToExchange;

    /*
     * Exchange policy errors
     */
    @JsonProperty(value = "policyResult")
    private ExchangePolicyErrors policyResult;

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

    /**
     * Get the sessionId property: Exchange session identifier.
     *
     * @return the sessionId value.
     */
    public String sessionId() {
        return this.sessionId;
    }

    /**
     * Set the sessionId property: Exchange session identifier.
     *
     * @param sessionId the sessionId value to set.
     * @return the CalculateExchangeResponseProperties object itself.
     */
    public CalculateExchangeResponseProperties withSessionId(String sessionId) {
        this.sessionId = sessionId;
        return this;
    }

    /**
     * Get the netPayable property: Pricing information containing the amount and the currency code.
     *
     * @return the netPayable value.
     */
    public Price netPayable() {
        return this.netPayable;
    }

    /**
     * Set the netPayable property: Pricing information containing the amount and the currency code.
     *
     * @param netPayable the netPayable value to set.
     * @return the CalculateExchangeResponseProperties object itself.
     */
    public CalculateExchangeResponseProperties withNetPayable(Price netPayable) {
        this.netPayable = netPayable;
        return this;
    }

    /**
     * Get the refundsTotal property: Pricing information containing the amount and the currency code.
     *
     * @return the refundsTotal value.
     */
    public Price refundsTotal() {
        return this.refundsTotal;
    }

    /**
     * Set the refundsTotal property: Pricing information containing the amount and the currency code.
     *
     * @param refundsTotal the refundsTotal value to set.
     * @return the CalculateExchangeResponseProperties object itself.
     */
    public CalculateExchangeResponseProperties withRefundsTotal(Price refundsTotal) {
        this.refundsTotal = refundsTotal;
        return this;
    }

    /**
     * Get the purchasesTotal property: Pricing information containing the amount and the currency code.
     *
     * @return the purchasesTotal value.
     */
    public Price purchasesTotal() {
        return this.purchasesTotal;
    }

    /**
     * Set the purchasesTotal property: Pricing information containing the amount and the currency code.
     *
     * @param purchasesTotal the purchasesTotal value to set.
     * @return the CalculateExchangeResponseProperties object itself.
     */
    public CalculateExchangeResponseProperties withPurchasesTotal(Price purchasesTotal) {
        this.purchasesTotal = purchasesTotal;
        return this;
    }

    /**
     * Get the reservationsToPurchase property: Details of the reservations being purchased.
     *
     * @return the reservationsToPurchase value.
     */
    public List<ReservationToPurchaseCalculateExchange> reservationsToPurchase() {
        return this.reservationsToPurchase;
    }

    /**
     * Set the reservationsToPurchase property: Details of the reservations being purchased.
     *
     * @param reservationsToPurchase the reservationsToPurchase value to set.
     * @return the CalculateExchangeResponseProperties object itself.
     */
    public CalculateExchangeResponseProperties withReservationsToPurchase(
        List<ReservationToPurchaseCalculateExchange> reservationsToPurchase) {
        this.reservationsToPurchase = reservationsToPurchase;
        return this;
    }

    /**
     * Get the savingsPlansToPurchase property: Details of the savings plans being purchased.
     *
     * @return the savingsPlansToPurchase value.
     */
    public List<SavingsPlanToPurchaseCalculateExchange> savingsPlansToPurchase() {
        return this.savingsPlansToPurchase;
    }

    /**
     * Set the savingsPlansToPurchase property: Details of the savings plans being purchased.
     *
     * @param savingsPlansToPurchase the savingsPlansToPurchase value to set.
     * @return the CalculateExchangeResponseProperties object itself.
     */
    public CalculateExchangeResponseProperties withSavingsPlansToPurchase(
        List<SavingsPlanToPurchaseCalculateExchange> savingsPlansToPurchase) {
        this.savingsPlansToPurchase = savingsPlansToPurchase;
        return this;
    }

    /**
     * Get the reservationsToExchange property: Details of the reservations being returned.
     *
     * @return the reservationsToExchange value.
     */
    public List<ReservationToExchange> reservationsToExchange() {
        return this.reservationsToExchange;
    }

    /**
     * Set the reservationsToExchange property: Details of the reservations being returned.
     *
     * @param reservationsToExchange the reservationsToExchange value to set.
     * @return the CalculateExchangeResponseProperties object itself.
     */
    public CalculateExchangeResponseProperties withReservationsToExchange(
        List<ReservationToExchange> reservationsToExchange) {
        this.reservationsToExchange = reservationsToExchange;
        return this;
    }

    /**
     * Get the policyResult property: Exchange policy errors.
     *
     * @return the policyResult value.
     */
    public ExchangePolicyErrors policyResult() {
        return this.policyResult;
    }

    /**
     * Set the policyResult property: Exchange policy errors.
     *
     * @param policyResult the policyResult value to set.
     * @return the CalculateExchangeResponseProperties object itself.
     */
    public CalculateExchangeResponseProperties withPolicyResult(ExchangePolicyErrors policyResult) {
        this.policyResult = policyResult;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (netPayable() != null) {
            netPayable().validate();
        }
        if (refundsTotal() != null) {
            refundsTotal().validate();
        }
        if (purchasesTotal() != null) {
            purchasesTotal().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());
        }
        if (policyResult() != null) {
            policyResult().validate();
        }
    }
}
