// 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.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.consumption.fluent.models.ModernUsageDetailProperties;
import com.azure.resourcemanager.consumption.fluent.models.UsageDetailInner;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.math.BigDecimal;
import java.time.OffsetDateTime;
import java.util.UUID;

/** Modern usage detail. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind")
@JsonTypeName("modern")
@Fluent
public final class ModernUsageDetail extends UsageDetailInner {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(ModernUsageDetail.class);

    /*
     * Properties for modern usage details
     */
    @JsonProperty(value = "properties", required = true)
    private ModernUsageDetailProperties innerProperties = new ModernUsageDetailProperties();

    /**
     * Get the innerProperties property: Properties for modern usage details.
     *
     * @return the innerProperties value.
     */
    private ModernUsageDetailProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the billingAccountId property: Billing Account identifier.
     *
     * @return the billingAccountId value.
     */
    public String billingAccountId() {
        return this.innerProperties() == null ? null : this.innerProperties().billingAccountId();
    }

    /**
     * Get the effectivePrice property: Effective Price that's charged for the usage.
     *
     * @return the effectivePrice value.
     */
    public BigDecimal effectivePrice() {
        return this.innerProperties() == null ? null : this.innerProperties().effectivePrice();
    }

    /**
     * Get the pricingModel property: Identifier that indicates how the meter is priced.
     *
     * @return the pricingModel value.
     */
    public PricingModelType pricingModel() {
        return this.innerProperties() == null ? null : this.innerProperties().pricingModel();
    }

    /**
     * Get the billingAccountName property: Name of the Billing Account.
     *
     * @return the billingAccountName value.
     */
    public String billingAccountName() {
        return this.innerProperties() == null ? null : this.innerProperties().billingAccountName();
    }

    /**
     * Get the billingPeriodStartDate property: Billing Period Start Date as in the invoice.
     *
     * @return the billingPeriodStartDate value.
     */
    public OffsetDateTime billingPeriodStartDate() {
        return this.innerProperties() == null ? null : this.innerProperties().billingPeriodStartDate();
    }

    /**
     * Get the billingPeriodEndDate property: Billing Period End Date as in the invoice.
     *
     * @return the billingPeriodEndDate value.
     */
    public OffsetDateTime billingPeriodEndDate() {
        return this.innerProperties() == null ? null : this.innerProperties().billingPeriodEndDate();
    }

    /**
     * Get the billingProfileId property: Identifier for the billing profile that groups costs across invoices in the a
     * singular billing currency across across the customers who have onboarded the Microsoft customer agreement and the
     * customers in CSP who have made entitlement purchases like SaaS, Marketplace, RI, etc.
     *
     * @return the billingProfileId value.
     */
    public String billingProfileId() {
        return this.innerProperties() == null ? null : this.innerProperties().billingProfileId();
    }

    /**
     * Get the billingProfileName property: Name of the billing profile that groups costs across invoices in the a
     * singular billing currency across across the customers who have onboarded the Microsoft customer agreement and the
     * customers in CSP who have made entitlement purchases like SaaS, Marketplace, RI, etc.
     *
     * @return the billingProfileName value.
     */
    public String billingProfileName() {
        return this.innerProperties() == null ? null : this.innerProperties().billingProfileName();
    }

    /**
     * Get the subscriptionGuid property: Unique Microsoft generated identifier for the Azure Subscription.
     *
     * @return the subscriptionGuid value.
     */
    public String subscriptionGuid() {
        return this.innerProperties() == null ? null : this.innerProperties().subscriptionGuid();
    }

    /**
     * Get the subscriptionName property: Name of the Azure Subscription.
     *
     * @return the subscriptionName value.
     */
    public String subscriptionName() {
        return this.innerProperties() == null ? null : this.innerProperties().subscriptionName();
    }

    /**
     * Get the date property: Date for the usage record.
     *
     * @return the date value.
     */
    public OffsetDateTime date() {
        return this.innerProperties() == null ? null : this.innerProperties().date();
    }

    /**
     * Get the product property: Name of the product that has accrued charges by consumption or purchase as listed in
     * the invoice. Not available for Marketplace.
     *
     * @return the product value.
     */
    public String product() {
        return this.innerProperties() == null ? null : this.innerProperties().product();
    }

    /**
     * Get the meterId property: The meter id (GUID). Not available for marketplace. For reserved instance this
     * represents the primary meter for which the reservation was purchased. For the actual VM Size for which the
     * reservation is purchased see productOrderName.
     *
     * @return the meterId value.
     */
    public UUID meterId() {
        return this.innerProperties() == null ? null : this.innerProperties().meterId();
    }

    /**
     * Get the meterName property: Identifies the name of the meter against which consumption is measured.
     *
     * @return the meterName value.
     */
    public String meterName() {
        return this.innerProperties() == null ? null : this.innerProperties().meterName();
    }

    /**
     * Get the meterRegion property: Identifies the location of the datacenter for certain services that are priced
     * based on datacenter location.
     *
     * @return the meterRegion value.
     */
    public String meterRegion() {
        return this.innerProperties() == null ? null : this.innerProperties().meterRegion();
    }

    /**
     * Get the meterCategory property: Identifies the top-level service for the usage.
     *
     * @return the meterCategory value.
     */
    public String meterCategory() {
        return this.innerProperties() == null ? null : this.innerProperties().meterCategory();
    }

    /**
     * Get the meterSubCategory property: Defines the type or sub-category of Azure service that can affect the rate.
     *
     * @return the meterSubCategory value.
     */
    public String meterSubCategory() {
        return this.innerProperties() == null ? null : this.innerProperties().meterSubCategory();
    }

    /**
     * Get the serviceFamily property: List the service family for the product purchased or charged (Example: Storage ;
     * Compute).
     *
     * @return the serviceFamily value.
     */
    public String serviceFamily() {
        return this.innerProperties() == null ? null : this.innerProperties().serviceFamily();
    }

    /**
     * Get the quantity property: Measure the quantity purchased or consumed.The amount of the meter used during the
     * billing period.
     *
     * @return the quantity value.
     */
    public BigDecimal quantity() {
        return this.innerProperties() == null ? null : this.innerProperties().quantity();
    }

    /**
     * Get the unitOfMeasure property: Identifies the Unit that the service is charged in. For example, GB, hours,
     * 10,000 s.
     *
     * @return the unitOfMeasure value.
     */
    public String unitOfMeasure() {
        return this.innerProperties() == null ? null : this.innerProperties().unitOfMeasure();
    }

    /**
     * Get the instanceName property: Instance Name.
     *
     * @return the instanceName value.
     */
    public String instanceName() {
        return this.innerProperties() == null ? null : this.innerProperties().instanceName();
    }

    /**
     * Get the costInUsd property: Estimated extendedCost or blended cost before tax in USD.
     *
     * @return the costInUsd value.
     */
    public BigDecimal costInUsd() {
        return this.innerProperties() == null ? null : this.innerProperties().costInUsd();
    }

    /**
     * Get the unitPrice property: Unit Price is the price applicable to you. (your EA or other contract price).
     *
     * @return the unitPrice value.
     */
    public BigDecimal unitPrice() {
        return this.innerProperties() == null ? null : this.innerProperties().unitPrice();
    }

    /**
     * Get the billingCurrencyCode property: The currency defining the billed cost.
     *
     * @return the billingCurrencyCode value.
     */
    public String billingCurrencyCode() {
        return this.innerProperties() == null ? null : this.innerProperties().billingCurrencyCode();
    }

    /**
     * Get the resourceLocation property: Name of the resource location.
     *
     * @return the resourceLocation value.
     */
    public String resourceLocation() {
        return this.innerProperties() == null ? null : this.innerProperties().resourceLocation();
    }

    /**
     * Get the consumedService property: Consumed service name. Name of the azure resource provider that emits the usage
     * or was purchased. This value is not provided for marketplace usage.
     *
     * @return the consumedService value.
     */
    public String consumedService() {
        return this.innerProperties() == null ? null : this.innerProperties().consumedService();
    }

    /**
     * Get the serviceInfo1 property: Service-specific metadata.
     *
     * @return the serviceInfo1 value.
     */
    public String serviceInfo1() {
        return this.innerProperties() == null ? null : this.innerProperties().serviceInfo1();
    }

    /**
     * Get the serviceInfo2 property: Legacy field with optional service-specific metadata.
     *
     * @return the serviceInfo2 value.
     */
    public String serviceInfo2() {
        return this.innerProperties() == null ? null : this.innerProperties().serviceInfo2();
    }

    /**
     * Get the additionalInfo property: Additional details of this usage item. Use this field to get usage line item
     * specific details such as the actual VM Size (ServiceType) or the ratio in which the reservation discount is
     * applied.
     *
     * @return the additionalInfo value.
     */
    public String additionalInfo() {
        return this.innerProperties() == null ? null : this.innerProperties().additionalInfo();
    }

    /**
     * Get the invoiceSectionId property: Identifier of the project that is being charged in the invoice. Not applicable
     * for Microsoft Customer Agreements onboarded by partners.
     *
     * @return the invoiceSectionId value.
     */
    public String invoiceSectionId() {
        return this.innerProperties() == null ? null : this.innerProperties().invoiceSectionId();
    }

    /**
     * Get the invoiceSectionName property: Name of the project that is being charged in the invoice. Not applicable for
     * Microsoft Customer Agreements onboarded by partners.
     *
     * @return the invoiceSectionName value.
     */
    public String invoiceSectionName() {
        return this.innerProperties() == null ? null : this.innerProperties().invoiceSectionName();
    }

    /**
     * Get the costCenter property: The cost center of this department if it is a department and a cost center is
     * provided.
     *
     * @return the costCenter value.
     */
    public String costCenter() {
        return this.innerProperties() == null ? null : this.innerProperties().costCenter();
    }

    /**
     * Get the resourceGroup property: Name of the Azure resource group used for cohesive lifecycle management of
     * resources.
     *
     * @return the resourceGroup value.
     */
    public String resourceGroup() {
        return this.innerProperties() == null ? null : this.innerProperties().resourceGroup();
    }

    /**
     * Get the reservationId property: ARM resource id of the reservation. Only applies to records relevant to
     * reservations.
     *
     * @return the reservationId value.
     */
    public String reservationId() {
        return this.innerProperties() == null ? null : this.innerProperties().reservationId();
    }

    /**
     * Get the reservationName property: User provided display name of the reservation. Last known name for a particular
     * day is populated in the daily data. Only applies to records relevant to reservations.
     *
     * @return the reservationName value.
     */
    public String reservationName() {
        return this.innerProperties() == null ? null : this.innerProperties().reservationName();
    }

    /**
     * Get the productOrderId property: The identifier for the asset or Azure plan name that the subscription belongs
     * to. For example: Azure Plan. For reservations this is the Reservation Order ID.
     *
     * @return the productOrderId value.
     */
    public String productOrderId() {
        return this.innerProperties() == null ? null : this.innerProperties().productOrderId();
    }

    /**
     * Get the productOrderName property: Product Order Name. For reservations this is the SKU that was purchased.
     *
     * @return the productOrderName value.
     */
    public String productOrderName() {
        return this.innerProperties() == null ? null : this.innerProperties().productOrderName();
    }

    /**
     * Get the isAzureCreditEligible property: Determines if the cost is eligible to be paid for using Azure credits.
     *
     * @return the isAzureCreditEligible value.
     */
    public Boolean isAzureCreditEligible() {
        return this.innerProperties() == null ? null : this.innerProperties().isAzureCreditEligible();
    }

    /**
     * Get the term property: Term (in months). Displays the term for the validity of the offer. For example. In case of
     * reserved instances it displays 12 months for yearly term of reserved instance. For one time purchases or
     * recurring purchases, the terms displays 1 month; This is not applicable for Azure consumption.
     *
     * @return the term value.
     */
    public String term() {
        return this.innerProperties() == null ? null : this.innerProperties().term();
    }

    /**
     * Get the publisherName property: Name of the publisher of the service including Microsoft or Third Party
     * publishers.
     *
     * @return the publisherName value.
     */
    public String publisherName() {
        return this.innerProperties() == null ? null : this.innerProperties().publisherName();
    }

    /**
     * Get the publisherType property: Type of publisher that identifies if the publisher is first party, third party
     * reseller or third party agency.
     *
     * @return the publisherType value.
     */
    public String publisherType() {
        return this.innerProperties() == null ? null : this.innerProperties().publisherType();
    }

    /**
     * Get the chargeType property: Indicates a charge represents credits, usage, a Marketplace purchase, a reservation
     * fee, or a refund.
     *
     * @return the chargeType value.
     */
    public String chargeType() {
        return this.innerProperties() == null ? null : this.innerProperties().chargeType();
    }

    /**
     * Get the frequency property: Indicates how frequently this charge will occur. OneTime for purchases which only
     * happen once, Monthly for fees which recur every month, and UsageBased for charges based on how much a service is
     * used.
     *
     * @return the frequency value.
     */
    public String frequency() {
        return this.innerProperties() == null ? null : this.innerProperties().frequency();
    }

    /**
     * Get the costInBillingCurrency property: ExtendedCost or blended cost before tax in billed currency.
     *
     * @return the costInBillingCurrency value.
     */
    public BigDecimal costInBillingCurrency() {
        return this.innerProperties() == null ? null : this.innerProperties().costInBillingCurrency();
    }

    /**
     * Get the costInPricingCurrency property: ExtendedCost or blended cost before tax in pricing currency to correlate
     * with prices.
     *
     * @return the costInPricingCurrency value.
     */
    public BigDecimal costInPricingCurrency() {
        return this.innerProperties() == null ? null : this.innerProperties().costInPricingCurrency();
    }

    /**
     * Get the exchangeRate property: Exchange rate used in conversion from pricing currency to billing currency.
     *
     * @return the exchangeRate value.
     */
    public String exchangeRate() {
        return this.innerProperties() == null ? null : this.innerProperties().exchangeRate();
    }

    /**
     * Get the exchangeRateDate property: Date on which exchange rate used in conversion from pricing currency to
     * billing currency.
     *
     * @return the exchangeRateDate value.
     */
    public OffsetDateTime exchangeRateDate() {
        return this.innerProperties() == null ? null : this.innerProperties().exchangeRateDate();
    }

    /**
     * Get the invoiceId property: Invoice ID as on the invoice where the specific transaction appears.
     *
     * @return the invoiceId value.
     */
    public String invoiceId() {
        return this.innerProperties() == null ? null : this.innerProperties().invoiceId();
    }

    /**
     * Get the previousInvoiceId property: Reference to an original invoice there is a refund (negative cost). This is
     * populated only when there is a refund.
     *
     * @return the previousInvoiceId value.
     */
    public String previousInvoiceId() {
        return this.innerProperties() == null ? null : this.innerProperties().previousInvoiceId();
    }

    /**
     * Get the pricingCurrencyCode property: Pricing Billing Currency.
     *
     * @return the pricingCurrencyCode value.
     */
    public String pricingCurrencyCode() {
        return this.innerProperties() == null ? null : this.innerProperties().pricingCurrencyCode();
    }

    /**
     * Get the productIdentifier property: Identifier for the product that has accrued charges by consumption or
     * purchase . This is the concatenated key of productId and SkuId in partner center.
     *
     * @return the productIdentifier value.
     */
    public String productIdentifier() {
        return this.innerProperties() == null ? null : this.innerProperties().productIdentifier();
    }

    /**
     * Get the resourceLocationNormalized property: Resource Location Normalized.
     *
     * @return the resourceLocationNormalized value.
     */
    public String resourceLocationNormalized() {
        return this.innerProperties() == null ? null : this.innerProperties().resourceLocationNormalized();
    }

    /**
     * Get the servicePeriodStartDate property: Start date for the rating period when the service usage was rated for
     * charges. The prices for Azure services are determined for the rating period.
     *
     * @return the servicePeriodStartDate value.
     */
    public OffsetDateTime servicePeriodStartDate() {
        return this.innerProperties() == null ? null : this.innerProperties().servicePeriodStartDate();
    }

    /**
     * Get the servicePeriodEndDate property: End date for the period when the service usage was rated for charges. The
     * prices for Azure services are determined based on the rating period.
     *
     * @return the servicePeriodEndDate value.
     */
    public OffsetDateTime servicePeriodEndDate() {
        return this.innerProperties() == null ? null : this.innerProperties().servicePeriodEndDate();
    }

    /**
     * Get the customerTenantId property: Identifier of the customer's AAD tenant.
     *
     * @return the customerTenantId value.
     */
    public String customerTenantId() {
        return this.innerProperties() == null ? null : this.innerProperties().customerTenantId();
    }

    /**
     * Get the customerName property: Name of the customer's AAD tenant.
     *
     * @return the customerName value.
     */
    public String customerName() {
        return this.innerProperties() == null ? null : this.innerProperties().customerName();
    }

    /**
     * Get the partnerTenantId property: Identifier for the partner's AAD tenant.
     *
     * @return the partnerTenantId value.
     */
    public String partnerTenantId() {
        return this.innerProperties() == null ? null : this.innerProperties().partnerTenantId();
    }

    /**
     * Get the partnerName property: Name of the partner' AAD tenant.
     *
     * @return the partnerName value.
     */
    public String partnerName() {
        return this.innerProperties() == null ? null : this.innerProperties().partnerName();
    }

    /**
     * Get the resellerMpnId property: MPNId for the reseller associated with the subscription.
     *
     * @return the resellerMpnId value.
     */
    public String resellerMpnId() {
        return this.innerProperties() == null ? null : this.innerProperties().resellerMpnId();
    }

    /**
     * Get the resellerName property: Reseller Name.
     *
     * @return the resellerName value.
     */
    public String resellerName() {
        return this.innerProperties() == null ? null : this.innerProperties().resellerName();
    }

    /**
     * Get the publisherId property: Publisher Id.
     *
     * @return the publisherId value.
     */
    public String publisherId() {
        return this.innerProperties() == null ? null : this.innerProperties().publisherId();
    }

    /**
     * Get the marketPrice property: Market Price that's charged for the usage.
     *
     * @return the marketPrice value.
     */
    public BigDecimal marketPrice() {
        return this.innerProperties() == null ? null : this.innerProperties().marketPrice();
    }

    /**
     * Get the exchangeRatePricingToBilling property: Exchange Rate from pricing currency to billing currency.
     *
     * @return the exchangeRatePricingToBilling value.
     */
    public BigDecimal exchangeRatePricingToBilling() {
        return this.innerProperties() == null ? null : this.innerProperties().exchangeRatePricingToBilling();
    }

    /**
     * Get the paygCostInBillingCurrency property: The amount of PayG cost before tax in billing currency.
     *
     * @return the paygCostInBillingCurrency value.
     */
    public BigDecimal paygCostInBillingCurrency() {
        return this.innerProperties() == null ? null : this.innerProperties().paygCostInBillingCurrency();
    }

    /**
     * Get the paygCostInUsd property: The amount of PayG cost before tax in US Dollar currency.
     *
     * @return the paygCostInUsd value.
     */
    public BigDecimal paygCostInUsd() {
        return this.innerProperties() == null ? null : this.innerProperties().paygCostInUsd();
    }

    /**
     * Get the partnerEarnedCreditRate property: Rate of discount applied if there is a partner earned credit (PEC)
     * based on partner admin link access.
     *
     * @return the partnerEarnedCreditRate value.
     */
    public BigDecimal partnerEarnedCreditRate() {
        return this.innerProperties() == null ? null : this.innerProperties().partnerEarnedCreditRate();
    }

    /**
     * Get the partnerEarnedCreditApplied property: Flag to indicate if partner earned credit has been applied or not.
     *
     * @return the partnerEarnedCreditApplied value.
     */
    public String partnerEarnedCreditApplied() {
        return this.innerProperties() == null ? null : this.innerProperties().partnerEarnedCreditApplied();
    }

    /**
     * Get the payGPrice property: Retail price for the resource.
     *
     * @return the payGPrice value.
     */
    public BigDecimal payGPrice() {
        return this.innerProperties() == null ? null : this.innerProperties().payGPrice();
    }

    /**
     * Get the benefitId property: Unique identifier for the applicable benefit.
     *
     * @return the benefitId value.
     */
    public String benefitId() {
        return this.innerProperties() == null ? null : this.innerProperties().benefitId();
    }

    /**
     * Get the benefitName property: Name of the applicable benefit.
     *
     * @return the benefitName value.
     */
    public String benefitName() {
        return this.innerProperties() == null ? null : this.innerProperties().benefitName();
    }

    /**
     * Get the provider property: Identifier for Product Category or Line Of Business, Ex - Azure, Microsoft 365, AWS
     * e.t.c.
     *
     * @return the provider value.
     */
    public String provider() {
        return this.innerProperties() == null ? null : this.innerProperties().provider();
    }

    /**
     * Get the costAllocationRuleName property: Name for Cost Allocation Rule.
     *
     * @return the costAllocationRuleName value.
     */
    public String costAllocationRuleName() {
        return this.innerProperties() == null ? null : this.innerProperties().costAllocationRuleName();
    }

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