// 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.BillingPlan;
import com.azure.resourcemanager.billingbenefits.models.BillingPlanInformation;
import com.azure.resourcemanager.billingbenefits.models.ExtendedStatusInfo;
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;
import java.time.OffsetDateTime;
import java.util.List;

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

    /*
     * Savings plan order properties
     */
    @JsonProperty(value = "properties")
    private SavingsPlanOrderModelProperties 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 SavingsPlanOrderModelInner class. */
    public SavingsPlanOrderModelInner() {
    }

    /**
     * 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 SavingsPlanOrderModelInner object itself.
     */
    public SavingsPlanOrderModelInner withSku(Sku sku) {
        this.sku = sku;
        return this;
    }

    /**
     * Get the innerProperties property: Savings plan order properties.
     *
     * @return the innerProperties value.
     */
    private SavingsPlanOrderModelProperties 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 SavingsPlanOrderModelInner object itself.
     */
    public SavingsPlanOrderModelInner withDisplayName(String displayName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SavingsPlanOrderModelProperties();
        }
        this.innerProperties().withDisplayName(displayName);
        return this;
    }

    /**
     * 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 SavingsPlanOrderModelInner object itself.
     */
    public SavingsPlanOrderModelInner withBillingScopeId(String billingScopeId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SavingsPlanOrderModelProperties();
        }
        this.innerProperties().withBillingScopeId(billingScopeId);
        return this;
    }

    /**
     * Get the billingProfileId property: Fully-qualified identifier of the billing profile where the savings plan is
     * applied. Present only for Field-led or Customer-led customers.
     *
     * @return the billingProfileId value.
     */
    public String billingProfileId() {
        return this.innerProperties() == null ? null : this.innerProperties().billingProfileId();
    }

    /**
     * Get the customerId property: Fully-qualified identifier of the customer where the savings plan is applied.
     * Present only for Partner-led customers.
     *
     * @return the customerId value.
     */
    public String customerId() {
        return this.innerProperties() == null ? null : this.innerProperties().customerId();
    }

    /**
     * Get the billingAccountId property: Fully-qualified identifier of the billing account where the savings plan is
     * applied. Present only for Enterprise Agreement customers.
     *
     * @return the billingAccountId value.
     */
    public String billingAccountId() {
        return this.innerProperties() == null ? null : this.innerProperties().billingAccountId();
    }

    /**
     * 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 SavingsPlanOrderModelInner object itself.
     */
    public SavingsPlanOrderModelInner withTerm(Term term) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SavingsPlanOrderModelProperties();
        }
        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 SavingsPlanOrderModelInner object itself.
     */
    public SavingsPlanOrderModelInner withBillingPlan(BillingPlan billingPlan) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SavingsPlanOrderModelProperties();
        }
        this.innerProperties().withBillingPlan(billingPlan);
        return this;
    }

    /**
     * Get the expiryDateTime property: Expiry date time.
     *
     * @return the expiryDateTime value.
     */
    public OffsetDateTime expiryDateTime() {
        return this.innerProperties() == null ? null : this.innerProperties().expiryDateTime();
    }

    /**
     * Get the benefitStartTime property: This is the DateTime when the savings plan benefit started.
     *
     * @return the benefitStartTime value.
     */
    public OffsetDateTime benefitStartTime() {
        return this.innerProperties() == null ? null : this.innerProperties().benefitStartTime();
    }

    /**
     * Set the benefitStartTime property: This is the DateTime when the savings plan benefit started.
     *
     * @param benefitStartTime the benefitStartTime value to set.
     * @return the SavingsPlanOrderModelInner object itself.
     */
    public SavingsPlanOrderModelInner withBenefitStartTime(OffsetDateTime benefitStartTime) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SavingsPlanOrderModelProperties();
        }
        this.innerProperties().withBenefitStartTime(benefitStartTime);
        return this;
    }

    /**
     * Get the planInformation property: Information describing the type of billing plan for this savings plan.
     *
     * @return the planInformation value.
     */
    public BillingPlanInformation planInformation() {
        return this.innerProperties() == null ? null : this.innerProperties().planInformation();
    }

    /**
     * Set the planInformation property: Information describing the type of billing plan for this savings plan.
     *
     * @param planInformation the planInformation value to set.
     * @return the SavingsPlanOrderModelInner object itself.
     */
    public SavingsPlanOrderModelInner withPlanInformation(BillingPlanInformation planInformation) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SavingsPlanOrderModelProperties();
        }
        this.innerProperties().withPlanInformation(planInformation);
        return this;
    }

    /**
     * Get the savingsPlans property: The savingsPlans property.
     *
     * @return the savingsPlans value.
     */
    public List<String> savingsPlans() {
        return this.innerProperties() == null ? null : this.innerProperties().savingsPlans();
    }

    /**
     * Set the savingsPlans property: The savingsPlans property.
     *
     * @param savingsPlans the savingsPlans value to set.
     * @return the SavingsPlanOrderModelInner object itself.
     */
    public SavingsPlanOrderModelInner withSavingsPlans(List<String> savingsPlans) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SavingsPlanOrderModelProperties();
        }
        this.innerProperties().withSavingsPlans(savingsPlans);
        return this;
    }

    /**
     * Get the extendedStatusInfo property: The extendedStatusInfo property.
     *
     * @return the extendedStatusInfo value.
     */
    public ExtendedStatusInfo extendedStatusInfo() {
        return this.innerProperties() == null ? null : this.innerProperties().extendedStatusInfo();
    }

    /**
     * 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 SavingsPlanOrderModelInner"));
        } else {
            sku().validate();
        }
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }

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