// 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.ProvisioningState;
import com.azure.resourcemanager.reservations.models.ReservationBillingPlan;
import com.azure.resourcemanager.reservations.models.ReservationOrderBillingPlanInformation;
import com.azure.resourcemanager.reservations.models.ReservationTerm;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.List;

/** Properties of a reservation order. */
@Fluent
public final class ReservationOrderProperties {
    /*
     * Friendly name for user to easily identified the reservation.
     */
    @JsonProperty(value = "displayName")
    private String displayName;

    /*
     * This is the DateTime when the reservation was initially requested for purchase.
     */
    @JsonProperty(value = "requestDateTime")
    private OffsetDateTime requestDateTime;

    /*
     * This is the DateTime when the reservation was created.
     */
    @JsonProperty(value = "createdDateTime")
    private OffsetDateTime createdDateTime;

    /*
     * This is the date when the reservation will expire.
     */
    @JsonProperty(value = "expiryDate")
    private LocalDate expiryDate;

    /*
     * This is the date-time when the reservation will expire.
     */
    @JsonProperty(value = "expiryDateTime")
    private OffsetDateTime expiryDateTime;

    /*
     * This is the DateTime when the reservation benefit started.
     */
    @JsonProperty(value = "benefitStartTime")
    private OffsetDateTime benefitStartTime;

    /*
     * Total Quantity of the skus purchased in the reservation.
     */
    @JsonProperty(value = "originalQuantity")
    private Integer originalQuantity;

    /*
     * Represent the term of reservation.
     */
    @JsonProperty(value = "term")
    private ReservationTerm term;

    /*
     * Current state of the reservation.
     */
    @JsonProperty(value = "provisioningState")
    private ProvisioningState provisioningState;

    /*
     * Represent the billing plans.
     */
    @JsonProperty(value = "billingPlan")
    private ReservationBillingPlan billingPlan;

    /*
     * Information describing the type of billing plan for this reservation.
     */
    @JsonProperty(value = "planInformation")
    private ReservationOrderBillingPlanInformation planInformation;

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

    /*
     * This is the date-time when the Azure Hybrid Benefit needs to be reviewed.
     */
    @JsonProperty(value = "reviewDateTime")
    private OffsetDateTime reviewDateTime;

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

    /**
     * Get the displayName property: Friendly name for user to easily identified the reservation.
     *
     * @return the displayName value.
     */
    public String displayName() {
        return this.displayName;
    }

    /**
     * Set the displayName property: Friendly name for user to easily identified the reservation.
     *
     * @param displayName the displayName value to set.
     * @return the ReservationOrderProperties object itself.
     */
    public ReservationOrderProperties withDisplayName(String displayName) {
        this.displayName = displayName;
        return this;
    }

    /**
     * Get the requestDateTime property: This is the DateTime when the reservation was initially requested for purchase.
     *
     * @return the requestDateTime value.
     */
    public OffsetDateTime requestDateTime() {
        return this.requestDateTime;
    }

    /**
     * Set the requestDateTime property: This is the DateTime when the reservation was initially requested for purchase.
     *
     * @param requestDateTime the requestDateTime value to set.
     * @return the ReservationOrderProperties object itself.
     */
    public ReservationOrderProperties withRequestDateTime(OffsetDateTime requestDateTime) {
        this.requestDateTime = requestDateTime;
        return this;
    }

    /**
     * Get the createdDateTime property: This is the DateTime when the reservation was created.
     *
     * @return the createdDateTime value.
     */
    public OffsetDateTime createdDateTime() {
        return this.createdDateTime;
    }

    /**
     * Set the createdDateTime property: This is the DateTime when the reservation was created.
     *
     * @param createdDateTime the createdDateTime value to set.
     * @return the ReservationOrderProperties object itself.
     */
    public ReservationOrderProperties withCreatedDateTime(OffsetDateTime createdDateTime) {
        this.createdDateTime = createdDateTime;
        return this;
    }

    /**
     * Get the expiryDate property: This is the date when the reservation will expire.
     *
     * @return the expiryDate value.
     */
    public LocalDate expiryDate() {
        return this.expiryDate;
    }

    /**
     * Set the expiryDate property: This is the date when the reservation will expire.
     *
     * @param expiryDate the expiryDate value to set.
     * @return the ReservationOrderProperties object itself.
     */
    public ReservationOrderProperties withExpiryDate(LocalDate expiryDate) {
        this.expiryDate = expiryDate;
        return this;
    }

    /**
     * Get the expiryDateTime property: This is the date-time when the reservation will expire.
     *
     * @return the expiryDateTime value.
     */
    public OffsetDateTime expiryDateTime() {
        return this.expiryDateTime;
    }

    /**
     * Set the expiryDateTime property: This is the date-time when the reservation will expire.
     *
     * @param expiryDateTime the expiryDateTime value to set.
     * @return the ReservationOrderProperties object itself.
     */
    public ReservationOrderProperties withExpiryDateTime(OffsetDateTime expiryDateTime) {
        this.expiryDateTime = expiryDateTime;
        return this;
    }

    /**
     * Get the benefitStartTime property: This is the DateTime when the reservation benefit started.
     *
     * @return the benefitStartTime value.
     */
    public OffsetDateTime benefitStartTime() {
        return this.benefitStartTime;
    }

    /**
     * Set the benefitStartTime property: This is the DateTime when the reservation benefit started.
     *
     * @param benefitStartTime the benefitStartTime value to set.
     * @return the ReservationOrderProperties object itself.
     */
    public ReservationOrderProperties withBenefitStartTime(OffsetDateTime benefitStartTime) {
        this.benefitStartTime = benefitStartTime;
        return this;
    }

    /**
     * Get the originalQuantity property: Total Quantity of the skus purchased in the reservation.
     *
     * @return the originalQuantity value.
     */
    public Integer originalQuantity() {
        return this.originalQuantity;
    }

    /**
     * Set the originalQuantity property: Total Quantity of the skus purchased in the reservation.
     *
     * @param originalQuantity the originalQuantity value to set.
     * @return the ReservationOrderProperties object itself.
     */
    public ReservationOrderProperties withOriginalQuantity(Integer originalQuantity) {
        this.originalQuantity = originalQuantity;
        return this;
    }

    /**
     * Get the term property: Represent the term of reservation.
     *
     * @return the term value.
     */
    public ReservationTerm term() {
        return this.term;
    }

    /**
     * Set the term property: Represent the term of reservation.
     *
     * @param term the term value to set.
     * @return the ReservationOrderProperties object itself.
     */
    public ReservationOrderProperties withTerm(ReservationTerm term) {
        this.term = term;
        return this;
    }

    /**
     * Get the provisioningState property: Current state of the reservation.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Set the provisioningState property: Current state of the reservation.
     *
     * @param provisioningState the provisioningState value to set.
     * @return the ReservationOrderProperties object itself.
     */
    public ReservationOrderProperties withProvisioningState(ProvisioningState provisioningState) {
        this.provisioningState = provisioningState;
        return this;
    }

    /**
     * Get the billingPlan property: Represent the billing plans.
     *
     * @return the billingPlan value.
     */
    public ReservationBillingPlan billingPlan() {
        return this.billingPlan;
    }

    /**
     * Set the billingPlan property: Represent the billing plans.
     *
     * @param billingPlan the billingPlan value to set.
     * @return the ReservationOrderProperties object itself.
     */
    public ReservationOrderProperties withBillingPlan(ReservationBillingPlan billingPlan) {
        this.billingPlan = billingPlan;
        return this;
    }

    /**
     * Get the planInformation property: Information describing the type of billing plan for this reservation.
     *
     * @return the planInformation value.
     */
    public ReservationOrderBillingPlanInformation planInformation() {
        return this.planInformation;
    }

    /**
     * Set the planInformation property: Information describing the type of billing plan for this reservation.
     *
     * @param planInformation the planInformation value to set.
     * @return the ReservationOrderProperties object itself.
     */
    public ReservationOrderProperties withPlanInformation(ReservationOrderBillingPlanInformation planInformation) {
        this.planInformation = planInformation;
        return this;
    }

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

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

    /**
     * Get the reviewDateTime property: This is the date-time when the Azure Hybrid Benefit needs to be reviewed.
     *
     * @return the reviewDateTime value.
     */
    public OffsetDateTime reviewDateTime() {
        return this.reviewDateTime;
    }

    /**
     * Set the reviewDateTime property: This is the date-time when the Azure Hybrid Benefit needs to be reviewed.
     *
     * @param reviewDateTime the reviewDateTime value to set.
     * @return the ReservationOrderProperties object itself.
     */
    public ReservationOrderProperties withReviewDateTime(OffsetDateTime reviewDateTime) {
        this.reviewDateTime = reviewDateTime;
        return this;
    }

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