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

/** Properties of reservation purchase request. */
@Fluent
public final class PurchaseRequestProperties {
    /*
     * The type of the resource that is being reserved.
     */
    @JsonProperty(value = "reservedResourceType")
    private ReservedResourceType reservedResourceType;

    /*
     * Subscription that will be charged for purchasing reservation or savings plan
     */
    @JsonProperty(value = "billingScopeId")
    private String billingScopeId;

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

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

    /*
     * Quantity of the skus that are part of the reservation.
     */
    @JsonProperty(value = "quantity")
    private Integer quantity;

    /*
     * Friendly name of the reservation
     */
    @JsonProperty(value = "displayName")
    private String displayName;

    /*
     * Type of the Applied Scope.
     */
    @JsonProperty(value = "appliedScopeType")
    private AppliedScopeType appliedScopeType;

    /*
     * List of the subscriptions that the benefit will be applied. Do not specify if AppliedScopeType is Shared. This
     * property will be deprecated and replaced by appliedScopeProperties instead for Single AppliedScopeType.
     */
    @JsonProperty(value = "appliedScopes")
    private List<String> appliedScopes;

    /*
     * Properties specific to applied scope type. Not required if not applicable. Required and need to provide tenantId
     * and managementGroupId if AppliedScopeType is ManagementGroup
     */
    @JsonProperty(value = "appliedScopeProperties")
    private AppliedScopeProperties appliedScopeProperties;

    /*
     * Setting this to true will automatically purchase a new reservation on the expiration date time.
     */
    @JsonProperty(value = "renew")
    private Boolean renew;

    /*
     * Properties specific to each reserved resource type. Not required if not applicable.
     */
    @JsonProperty(value = "reservedResourceProperties")
    private PurchaseRequestPropertiesReservedResourceProperties reservedResourceProperties;

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

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

    /**
     * Get the reservedResourceType property: The type of the resource that is being reserved.
     *
     * @return the reservedResourceType value.
     */
    public ReservedResourceType reservedResourceType() {
        return this.reservedResourceType;
    }

    /**
     * Set the reservedResourceType property: The type of the resource that is being reserved.
     *
     * @param reservedResourceType the reservedResourceType value to set.
     * @return the PurchaseRequestProperties object itself.
     */
    public PurchaseRequestProperties withReservedResourceType(ReservedResourceType reservedResourceType) {
        this.reservedResourceType = reservedResourceType;
        return this;
    }

    /**
     * Get the billingScopeId property: Subscription that will be charged for purchasing reservation or savings plan.
     *
     * @return the billingScopeId value.
     */
    public String billingScopeId() {
        return this.billingScopeId;
    }

    /**
     * Set the billingScopeId property: Subscription that will be charged for purchasing reservation or savings plan.
     *
     * @param billingScopeId the billingScopeId value to set.
     * @return the PurchaseRequestProperties object itself.
     */
    public PurchaseRequestProperties withBillingScopeId(String billingScopeId) {
        this.billingScopeId = billingScopeId;
        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 PurchaseRequestProperties object itself.
     */
    public PurchaseRequestProperties withTerm(ReservationTerm term) {
        this.term = term;
        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 PurchaseRequestProperties object itself.
     */
    public PurchaseRequestProperties withBillingPlan(ReservationBillingPlan billingPlan) {
        this.billingPlan = billingPlan;
        return this;
    }

    /**
     * Get the quantity property: Quantity of the skus that are part of the reservation.
     *
     * @return the quantity value.
     */
    public Integer quantity() {
        return this.quantity;
    }

    /**
     * Set the quantity property: Quantity of the skus that are part of the reservation.
     *
     * @param quantity the quantity value to set.
     * @return the PurchaseRequestProperties object itself.
     */
    public PurchaseRequestProperties withQuantity(Integer quantity) {
        this.quantity = quantity;
        return this;
    }

    /**
     * Get the displayName property: Friendly name of the reservation.
     *
     * @return the displayName value.
     */
    public String displayName() {
        return this.displayName;
    }

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

    /**
     * Get the appliedScopeType property: Type of the Applied Scope.
     *
     * @return the appliedScopeType value.
     */
    public AppliedScopeType appliedScopeType() {
        return this.appliedScopeType;
    }

    /**
     * Set the appliedScopeType property: Type of the Applied Scope.
     *
     * @param appliedScopeType the appliedScopeType value to set.
     * @return the PurchaseRequestProperties object itself.
     */
    public PurchaseRequestProperties withAppliedScopeType(AppliedScopeType appliedScopeType) {
        this.appliedScopeType = appliedScopeType;
        return this;
    }

    /**
     * Get the appliedScopes property: List of the subscriptions that the benefit will be applied. Do not specify if
     * AppliedScopeType is Shared. This property will be deprecated and replaced by appliedScopeProperties instead for
     * Single AppliedScopeType.
     *
     * @return the appliedScopes value.
     */
    public List<String> appliedScopes() {
        return this.appliedScopes;
    }

    /**
     * Set the appliedScopes property: List of the subscriptions that the benefit will be applied. Do not specify if
     * AppliedScopeType is Shared. This property will be deprecated and replaced by appliedScopeProperties instead for
     * Single AppliedScopeType.
     *
     * @param appliedScopes the appliedScopes value to set.
     * @return the PurchaseRequestProperties object itself.
     */
    public PurchaseRequestProperties withAppliedScopes(List<String> appliedScopes) {
        this.appliedScopes = appliedScopes;
        return this;
    }

    /**
     * Get the appliedScopeProperties property: Properties specific to applied scope type. Not required if not
     * applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is ManagementGroup.
     *
     * @return the appliedScopeProperties value.
     */
    public AppliedScopeProperties appliedScopeProperties() {
        return this.appliedScopeProperties;
    }

    /**
     * Set the appliedScopeProperties property: Properties specific to applied scope type. Not required if not
     * applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is ManagementGroup.
     *
     * @param appliedScopeProperties the appliedScopeProperties value to set.
     * @return the PurchaseRequestProperties object itself.
     */
    public PurchaseRequestProperties withAppliedScopeProperties(AppliedScopeProperties appliedScopeProperties) {
        this.appliedScopeProperties = appliedScopeProperties;
        return this;
    }

    /**
     * Get the renew property: Setting this to true will automatically purchase a new reservation on the expiration date
     * time.
     *
     * @return the renew value.
     */
    public Boolean renew() {
        return this.renew;
    }

    /**
     * Set the renew property: Setting this to true will automatically purchase a new reservation on the expiration date
     * time.
     *
     * @param renew the renew value to set.
     * @return the PurchaseRequestProperties object itself.
     */
    public PurchaseRequestProperties withRenew(Boolean renew) {
        this.renew = renew;
        return this;
    }

    /**
     * Get the reservedResourceProperties property: Properties specific to each reserved resource type. Not required if
     * not applicable.
     *
     * @return the reservedResourceProperties value.
     */
    public PurchaseRequestPropertiesReservedResourceProperties reservedResourceProperties() {
        return this.reservedResourceProperties;
    }

    /**
     * Set the reservedResourceProperties property: Properties specific to each reserved resource type. Not required if
     * not applicable.
     *
     * @param reservedResourceProperties the reservedResourceProperties value to set.
     * @return the PurchaseRequestProperties object itself.
     */
    public PurchaseRequestProperties withReservedResourceProperties(
        PurchaseRequestPropertiesReservedResourceProperties reservedResourceProperties) {
        this.reservedResourceProperties = reservedResourceProperties;
        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 PurchaseRequestProperties object itself.
     */
    public PurchaseRequestProperties withReviewDateTime(OffsetDateTime reviewDateTime) {
        this.reviewDateTime = reviewDateTime;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (appliedScopeProperties() != null) {
            appliedScopeProperties().validate();
        }
        if (reservedResourceProperties() != null) {
            reservedResourceProperties().validate();
        }
    }
}
