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

/** Request body for savings plan purchase. */
@Fluent
public final class SavingsPlanPurchaseRequest {
    /*
     * The name of sku
     */
    @JsonProperty(value = "sku")
    private SkuName sku;

    /*
     * Properties of a savings plan purchase
     */
    @JsonProperty(value = "properties")
    private SavingsPlanPurchaseRequestProperties innerProperties;

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

    /**
     * Get the sku property: The name of sku.
     *
     * @return the sku value.
     */
    public SkuName sku() {
        return this.sku;
    }

    /**
     * Set the sku property: The name of sku.
     *
     * @param sku the sku value to set.
     * @return the SavingsPlanPurchaseRequest object itself.
     */
    public SavingsPlanPurchaseRequest withSku(SkuName sku) {
        this.sku = sku;
        return this;
    }

    /**
     * Get the innerProperties property: Properties of a savings plan purchase.
     *
     * @return the innerProperties value.
     */
    private SavingsPlanPurchaseRequestProperties innerProperties() {
        return this.innerProperties;
    }

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

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

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

    /**
     * Set the term property: Represent savings plan term in ISO 8601 format.
     *
     * @param term the term value to set.
     * @return the SavingsPlanPurchaseRequest object itself.
     */
    public SavingsPlanPurchaseRequest withTerm(SavingsPlanTerm term) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SavingsPlanPurchaseRequestProperties();
        }
        this.innerProperties().withTerm(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.innerProperties() == null ? null : this.innerProperties().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 SavingsPlanPurchaseRequest object itself.
     */
    public SavingsPlanPurchaseRequest withBillingPlan(BillingPlan billingPlan) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SavingsPlanPurchaseRequestProperties();
        }
        this.innerProperties().withBillingPlan(billingPlan);
        return this;
    }

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

    /**
     * Set the appliedScopeType property: Type of the Applied Scope.
     *
     * @param appliedScopeType the appliedScopeType value to set.
     * @return the SavingsPlanPurchaseRequest object itself.
     */
    public SavingsPlanPurchaseRequest withAppliedScopeType(AppliedScopeType appliedScopeType) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SavingsPlanPurchaseRequestProperties();
        }
        this.innerProperties().withAppliedScopeType(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.innerProperties() == null ? null : this.innerProperties().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 SavingsPlanPurchaseRequest object itself.
     */
    public SavingsPlanPurchaseRequest withAppliedScopeProperties(AppliedScopeProperties appliedScopeProperties) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SavingsPlanPurchaseRequestProperties();
        }
        this.innerProperties().withAppliedScopeProperties(appliedScopeProperties);
        return this;
    }

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

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

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