// 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.BillingPlan;
import com.azure.resourcemanager.reservations.models.Commitment;
import com.azure.resourcemanager.reservations.models.SavingsPlanTerm;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Properties of a savings plan purchase. */
@Fluent
public final class SavingsPlanPurchaseRequestProperties {
    /*
     * Friendly name of the savings plan
     */
    @JsonProperty(value = "displayName")
    private String displayName;

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

    /*
     * Represent savings plan term in ISO 8601 format.
     */
    @JsonProperty(value = "term")
    private SavingsPlanTerm term;

    /*
     * Represents the billing plan in ISO 8601 format. Required only for monthly billing plans.
     */
    @JsonProperty(value = "billingPlan")
    private BillingPlan billingPlan;

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

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

    /*
     * Commitment towards the benefit.
     */
    @JsonProperty(value = "commitment")
    private Commitment commitment;

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

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

    /**
     * Set the displayName property: Friendly name of the savings plan.
     *
     * @param displayName the displayName value to set.
     * @return the SavingsPlanPurchaseRequestProperties object itself.
     */
    public SavingsPlanPurchaseRequestProperties withDisplayName(String displayName) {
        this.displayName = displayName;
        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 SavingsPlanPurchaseRequestProperties object itself.
     */
    public SavingsPlanPurchaseRequestProperties withBillingScopeId(String billingScopeId) {
        this.billingScopeId = billingScopeId;
        return this;
    }

    /**
     * Get the term property: Represent savings plan term in ISO 8601 format.
     *
     * @return the term value.
     */
    public SavingsPlanTerm term() {
        return this.term;
    }

    /**
     * Set the term property: Represent savings plan term in ISO 8601 format.
     *
     * @param term the term value to set.
     * @return the SavingsPlanPurchaseRequestProperties object itself.
     */
    public SavingsPlanPurchaseRequestProperties withTerm(SavingsPlanTerm term) {
        this.term = term;
        return this;
    }

    /**
     * Get the billingPlan property: Represents the billing plan in ISO 8601 format. Required only for monthly billing
     * plans.
     *
     * @return the billingPlan value.
     */
    public BillingPlan billingPlan() {
        return this.billingPlan;
    }

    /**
     * Set the billingPlan property: Represents the billing plan in ISO 8601 format. Required only for monthly billing
     * plans.
     *
     * @param billingPlan the billingPlan value to set.
     * @return the SavingsPlanPurchaseRequestProperties object itself.
     */
    public SavingsPlanPurchaseRequestProperties withBillingPlan(BillingPlan billingPlan) {
        this.billingPlan = billingPlan;
        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 SavingsPlanPurchaseRequestProperties object itself.
     */
    public SavingsPlanPurchaseRequestProperties withAppliedScopeType(AppliedScopeType appliedScopeType) {
        this.appliedScopeType = appliedScopeType;
        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 SavingsPlanPurchaseRequestProperties object itself.
     */
    public SavingsPlanPurchaseRequestProperties withAppliedScopeProperties(
        AppliedScopeProperties appliedScopeProperties) {
        this.appliedScopeProperties = appliedScopeProperties;
        return this;
    }

    /**
     * Get the commitment property: Commitment towards the benefit.
     *
     * @return the commitment value.
     */
    public Commitment commitment() {
        return this.commitment;
    }

    /**
     * Set the commitment property: Commitment towards the benefit.
     *
     * @param commitment the commitment value to set.
     * @return the SavingsPlanPurchaseRequestProperties object itself.
     */
    public SavingsPlanPurchaseRequestProperties withCommitment(Commitment commitment) {
        this.commitment = commitment;
        return this;
    }

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