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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.consumption.models.BalancePropertiesAdjustmentDetailsItem;
import com.azure.resourcemanager.consumption.models.BalancePropertiesNewPurchasesDetailsItem;
import com.azure.resourcemanager.consumption.models.BillingFrequency;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/** A balance resource. */
@Fluent
public final class BalanceInner extends ProxyResource {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(BalanceInner.class);

    /*
     * The properties of the balance.
     */
    @JsonProperty(value = "properties")
    private BalanceProperties innerProperties;

    /*
     * The etag for the resource.
     */
    @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY)
    private String etag;

    /*
     * Resource tags.
     */
    @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY)
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, String> tags;

    /**
     * Get the innerProperties property: The properties of the balance.
     *
     * @return the innerProperties value.
     */
    private BalanceProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the etag property: The etag for the resource.
     *
     * @return the etag value.
     */
    public String etag() {
        return this.etag;
    }

    /**
     * Get the tags property: Resource tags.
     *
     * @return the tags value.
     */
    public Map<String, String> tags() {
        return this.tags;
    }

    /**
     * Get the currency property: The ISO currency in which the meter is charged, for example, USD.
     *
     * @return the currency value.
     */
    public String currency() {
        return this.innerProperties() == null ? null : this.innerProperties().currency();
    }

    /**
     * Get the beginningBalance property: The beginning balance for the billing period.
     *
     * @return the beginningBalance value.
     */
    public BigDecimal beginningBalance() {
        return this.innerProperties() == null ? null : this.innerProperties().beginningBalance();
    }

    /**
     * Get the endingBalance property: The ending balance for the billing period (for open periods this will be updated
     * daily).
     *
     * @return the endingBalance value.
     */
    public BigDecimal endingBalance() {
        return this.innerProperties() == null ? null : this.innerProperties().endingBalance();
    }

    /**
     * Get the newPurchases property: Total new purchase amount.
     *
     * @return the newPurchases value.
     */
    public BigDecimal newPurchases() {
        return this.innerProperties() == null ? null : this.innerProperties().newPurchases();
    }

    /**
     * Get the adjustments property: Total adjustment amount.
     *
     * @return the adjustments value.
     */
    public BigDecimal adjustments() {
        return this.innerProperties() == null ? null : this.innerProperties().adjustments();
    }

    /**
     * Get the utilized property: Total Commitment usage.
     *
     * @return the utilized value.
     */
    public BigDecimal utilized() {
        return this.innerProperties() == null ? null : this.innerProperties().utilized();
    }

    /**
     * Get the serviceOverage property: Overage for Azure services.
     *
     * @return the serviceOverage value.
     */
    public BigDecimal serviceOverage() {
        return this.innerProperties() == null ? null : this.innerProperties().serviceOverage();
    }

    /**
     * Get the chargesBilledSeparately property: Charges Billed separately.
     *
     * @return the chargesBilledSeparately value.
     */
    public BigDecimal chargesBilledSeparately() {
        return this.innerProperties() == null ? null : this.innerProperties().chargesBilledSeparately();
    }

    /**
     * Get the totalOverage property: serviceOverage + chargesBilledSeparately.
     *
     * @return the totalOverage value.
     */
    public BigDecimal totalOverage() {
        return this.innerProperties() == null ? null : this.innerProperties().totalOverage();
    }

    /**
     * Get the totalUsage property: Azure service commitment + total Overage.
     *
     * @return the totalUsage value.
     */
    public BigDecimal totalUsage() {
        return this.innerProperties() == null ? null : this.innerProperties().totalUsage();
    }

    /**
     * Get the azureMarketplaceServiceCharges property: Total charges for Azure Marketplace.
     *
     * @return the azureMarketplaceServiceCharges value.
     */
    public BigDecimal azureMarketplaceServiceCharges() {
        return this.innerProperties() == null ? null : this.innerProperties().azureMarketplaceServiceCharges();
    }

    /**
     * Get the billingFrequency property: The billing frequency.
     *
     * @return the billingFrequency value.
     */
    public BillingFrequency billingFrequency() {
        return this.innerProperties() == null ? null : this.innerProperties().billingFrequency();
    }

    /**
     * Set the billingFrequency property: The billing frequency.
     *
     * @param billingFrequency the billingFrequency value to set.
     * @return the BalanceInner object itself.
     */
    public BalanceInner withBillingFrequency(BillingFrequency billingFrequency) {
        if (this.innerProperties() == null) {
            this.innerProperties = new BalanceProperties();
        }
        this.innerProperties().withBillingFrequency(billingFrequency);
        return this;
    }

    /**
     * Get the priceHidden property: Price is hidden or not.
     *
     * @return the priceHidden value.
     */
    public Boolean priceHidden() {
        return this.innerProperties() == null ? null : this.innerProperties().priceHidden();
    }

    /**
     * Get the newPurchasesDetails property: List of new purchases.
     *
     * @return the newPurchasesDetails value.
     */
    public List<BalancePropertiesNewPurchasesDetailsItem> newPurchasesDetails() {
        return this.innerProperties() == null ? null : this.innerProperties().newPurchasesDetails();
    }

    /**
     * Get the adjustmentDetails property: List of Adjustments (Promo credit, SIE credit etc.).
     *
     * @return the adjustmentDetails value.
     */
    public List<BalancePropertiesAdjustmentDetailsItem> adjustmentDetails() {
        return this.innerProperties() == null ? null : this.innerProperties().adjustmentDetails();
    }

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