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

/** Exchange response properties. */
@Fluent
public final class ExchangeResponseProperties {
    /*
     * 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<ReservationToPurchaseExchange> reservationsToPurchase;

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

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

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

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

    /**
     * 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 ExchangeResponseProperties object itself.
     */
    public ExchangeResponseProperties 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 ExchangeResponseProperties object itself.
     */
    public ExchangeResponseProperties 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 ExchangeResponseProperties object itself.
     */
    public ExchangeResponseProperties 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 ExchangeResponseProperties object itself.
     */
    public ExchangeResponseProperties withPurchasesTotal(Price purchasesTotal) {
        this.purchasesTotal = purchasesTotal;
        return this;
    }

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

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

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

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

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

    /**
     * Set the reservationsToExchange property: Details of the reservations being returned.
     *
     * @param reservationsToExchange the reservationsToExchange value to set.
     * @return the ExchangeResponseProperties object itself.
     */
    public ExchangeResponseProperties withReservationsToExchange(
        List<ReservationToReturnForExchange> 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 ExchangeResponseProperties object itself.
     */
    public ExchangeResponseProperties 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();
        }
    }
}
