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

/** Reservation utilization. */
@Fluent
public final class ReservationsPropertiesUtilization {
    /*
     * last 7 day utilization trend for a reservation
     */
    @JsonProperty(value = "trend", access = JsonProperty.Access.WRITE_ONLY)
    private String trend;

    /*
     * The array of aggregates of a reservation's utilization
     */
    @JsonProperty(value = "aggregates")
    private List<ReservationUtilizationAggregates> aggregates;

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

    /**
     * Get the trend property: last 7 day utilization trend for a reservation.
     *
     * @return the trend value.
     */
    public String trend() {
        return this.trend;
    }

    /**
     * Get the aggregates property: The array of aggregates of a reservation's utilization.
     *
     * @return the aggregates value.
     */
    public List<ReservationUtilizationAggregates> aggregates() {
        return this.aggregates;
    }

    /**
     * Set the aggregates property: The array of aggregates of a reservation's utilization.
     *
     * @param aggregates the aggregates value to set.
     * @return the ReservationsPropertiesUtilization object itself.
     */
    public ReservationsPropertiesUtilization withAggregates(List<ReservationUtilizationAggregates> aggregates) {
        this.aggregates = aggregates;
        return this;
    }

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