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

/** Legacy charge summary. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind")
@JsonTypeName("legacy")
@Fluent
public final class LegacyChargeSummary extends ChargeSummary {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(LegacyChargeSummary.class);

    /*
     * Properties for legacy charge summary
     */
    @JsonProperty(value = "properties", required = true)
    private LegacyChargeSummaryProperties innerProperties = new LegacyChargeSummaryProperties();

    /**
     * Get the innerProperties property: Properties for legacy charge summary.
     *
     * @return the innerProperties value.
     */
    private LegacyChargeSummaryProperties innerProperties() {
        return this.innerProperties;
    }

    /** {@inheritDoc} */
    @Override
    public LegacyChargeSummary withEtag(String etag) {
        super.withEtag(etag);
        return this;
    }

    /**
     * Get the billingPeriodId property: The id of the billing period resource that the charge belongs to.
     *
     * @return the billingPeriodId value.
     */
    public String billingPeriodId() {
        return this.innerProperties() == null ? null : this.innerProperties().billingPeriodId();
    }

    /**
     * Get the usageStart property: Usage start date.
     *
     * @return the usageStart value.
     */
    public String usageStart() {
        return this.innerProperties() == null ? null : this.innerProperties().usageStart();
    }

    /**
     * Get the usageEnd property: Usage end date.
     *
     * @return the usageEnd value.
     */
    public String usageEnd() {
        return this.innerProperties() == null ? null : this.innerProperties().usageEnd();
    }

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

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

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

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

    /**
     * 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 LegacyChargeSummary"));
        } else {
            innerProperties().validate();
        }
    }
}
