// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.billingbenefits.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.billingbenefits.models.AppliedScopeProperties;
import com.azure.resourcemanager.billingbenefits.models.AppliedScopeType;
import com.azure.resourcemanager.billingbenefits.models.BillingPlan;
import com.azure.resourcemanager.billingbenefits.models.Commitment;
import com.azure.resourcemanager.billingbenefits.models.ProvisioningState;
import com.azure.resourcemanager.billingbenefits.models.Sku;
import com.azure.resourcemanager.billingbenefits.models.Term;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Savings plan order alias. */
@Fluent
public final class SavingsPlanOrderAliasModelInner extends ProxyResource {
    /*
     * Savings plan SKU
     */
    @JsonProperty(value = "sku", required = true)
    private Sku sku;

    /*
     * Resource provider kind
     */
    @JsonProperty(value = "kind")
    private String kind;

    /*
     * Savings plan order alias properties
     */
    @JsonProperty(value = "properties")
    private SavingsPlanOrderAliasProperties innerProperties;

    /*
     * Azure Resource Manager metadata containing createdBy and modifiedBy information.
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

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

    /**
     * Get the sku property: Savings plan SKU.
     *
     * @return the sku value.
     */
    public Sku sku() {
        return this.sku;
    }

    /**
     * Set the sku property: Savings plan SKU.
     *
     * @param sku the sku value to set.
     * @return the SavingsPlanOrderAliasModelInner object itself.
     */
    public SavingsPlanOrderAliasModelInner withSku(Sku sku) {
        this.sku = sku;
        return this;
    }

    /**
     * Get the kind property: Resource provider kind.
     *
     * @return the kind value.
     */
    public String kind() {
        return this.kind;
    }

    /**
     * Set the kind property: Resource provider kind.
     *
     * @param kind the kind value to set.
     * @return the SavingsPlanOrderAliasModelInner object itself.
     */
    public SavingsPlanOrderAliasModelInner withKind(String kind) {
        this.kind = kind;
        return this;
    }

    /**
     * Get the innerProperties property: Savings plan order alias properties.
     *
     * @return the innerProperties value.
     */
    private SavingsPlanOrderAliasProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

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

    /**
     * Set the displayName property: Display name.
     *
     * @param displayName the displayName value to set.
     * @return the SavingsPlanOrderAliasModelInner object itself.
     */
    public SavingsPlanOrderAliasModelInner withDisplayName(String displayName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SavingsPlanOrderAliasProperties();
        }
        this.innerProperties().withDisplayName(displayName);
        return this;
    }

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

    /**
     * Get the provisioningState property: Provisioning state.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the billingScopeId property: Subscription that will be charged for purchasing the benefit.
     *
     * @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 the benefit.
     *
     * @param billingScopeId the billingScopeId value to set.
     * @return the SavingsPlanOrderAliasModelInner object itself.
     */
    public SavingsPlanOrderAliasModelInner withBillingScopeId(String billingScopeId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SavingsPlanOrderAliasProperties();
        }
        this.innerProperties().withBillingScopeId(billingScopeId);
        return this;
    }

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

    /**
     * Set the term property: Represent benefit term in ISO 8601 format.
     *
     * @param term the term value to set.
     * @return the SavingsPlanOrderAliasModelInner object itself.
     */
    public SavingsPlanOrderAliasModelInner withTerm(Term term) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SavingsPlanOrderAliasProperties();
        }
        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 SavingsPlanOrderAliasModelInner object itself.
     */
    public SavingsPlanOrderAliasModelInner withBillingPlan(BillingPlan billingPlan) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SavingsPlanOrderAliasProperties();
        }
        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 SavingsPlanOrderAliasModelInner object itself.
     */
    public SavingsPlanOrderAliasModelInner withAppliedScopeType(AppliedScopeType appliedScopeType) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SavingsPlanOrderAliasProperties();
        }
        this.innerProperties().withAppliedScopeType(appliedScopeType);
        return this;
    }

    /**
     * Get the appliedScopeProperties property: Properties specific to applied scope type. Not required if not
     * applicable.
     *
     * @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.
     *
     * @param appliedScopeProperties the appliedScopeProperties value to set.
     * @return the SavingsPlanOrderAliasModelInner object itself.
     */
    public SavingsPlanOrderAliasModelInner withAppliedScopeProperties(AppliedScopeProperties appliedScopeProperties) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SavingsPlanOrderAliasProperties();
        }
        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 SavingsPlanOrderAliasModelInner object itself.
     */
    public SavingsPlanOrderAliasModelInner withCommitment(Commitment commitment) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SavingsPlanOrderAliasProperties();
        }
        this.innerProperties().withCommitment(commitment);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (sku() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property sku in model SavingsPlanOrderAliasModelInner"));
        } else {
            sku().validate();
        }
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(SavingsPlanOrderAliasModelInner.class);
}
