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

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.reservations.models.ChangeDirectoryResult;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Change directory response. */
@Fluent
public final class ChangeDirectoryResponseInner {
    /*
     * Change directory result for reservation order or reservation
     */
    @JsonProperty(value = "reservationOrder")
    private ChangeDirectoryResult reservationOrder;

    /*
     * The reservations property.
     */
    @JsonProperty(value = "reservations")
    private List<ChangeDirectoryResult> reservations;

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

    /**
     * Get the reservationOrder property: Change directory result for reservation order or reservation.
     *
     * @return the reservationOrder value.
     */
    public ChangeDirectoryResult reservationOrder() {
        return this.reservationOrder;
    }

    /**
     * Set the reservationOrder property: Change directory result for reservation order or reservation.
     *
     * @param reservationOrder the reservationOrder value to set.
     * @return the ChangeDirectoryResponseInner object itself.
     */
    public ChangeDirectoryResponseInner withReservationOrder(ChangeDirectoryResult reservationOrder) {
        this.reservationOrder = reservationOrder;
        return this;
    }

    /**
     * Get the reservations property: The reservations property.
     *
     * @return the reservations value.
     */
    public List<ChangeDirectoryResult> reservations() {
        return this.reservations;
    }

    /**
     * Set the reservations property: The reservations property.
     *
     * @param reservations the reservations value to set.
     * @return the ChangeDirectoryResponseInner object itself.
     */
    public ChangeDirectoryResponseInner withReservations(List<ChangeDirectoryResult> reservations) {
        this.reservations = reservations;
        return this;
    }

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