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

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

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.commerce.models.InfoField;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.UUID;

/** Describes the usageAggregation. */
@Fluent
public final class UsageAggregationInner {
    /*
     * Unique Id for the usage aggregate.
     */
    @JsonProperty(value = "id")
    private String id;

    /*
     * Name of the usage aggregate.
     */
    @JsonProperty(value = "name")
    private String name;

    /*
     * Type of the resource being returned.
     */
    @JsonProperty(value = "type")
    private String type;

    /*
     * Usage data.
     */
    @JsonProperty(value = "properties")
    private UsageSample innerProperties;

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

    /**
     * Get the id property: Unique Id for the usage aggregate.
     *
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

    /**
     * Set the id property: Unique Id for the usage aggregate.
     *
     * @param id the id value to set.
     * @return the UsageAggregationInner object itself.
     */
    public UsageAggregationInner withId(String id) {
        this.id = id;
        return this;
    }

    /**
     * Get the name property: Name of the usage aggregate.
     *
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: Name of the usage aggregate.
     *
     * @param name the name value to set.
     * @return the UsageAggregationInner object itself.
     */
    public UsageAggregationInner withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the type property: Type of the resource being returned.
     *
     * @return the type value.
     */
    public String type() {
        return this.type;
    }

    /**
     * Set the type property: Type of the resource being returned.
     *
     * @param type the type value to set.
     * @return the UsageAggregationInner object itself.
     */
    public UsageAggregationInner withType(String type) {
        this.type = type;
        return this;
    }

    /**
     * Get the innerProperties property: Usage data.
     *
     * @return the innerProperties value.
     */
    private UsageSample innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the subscriptionId property: The subscription identifier for the Azure user.
     *
     * @return the subscriptionId value.
     */
    public UUID subscriptionId() {
        return this.innerProperties() == null ? null : this.innerProperties().subscriptionId();
    }

    /**
     * Set the subscriptionId property: The subscription identifier for the Azure user.
     *
     * @param subscriptionId the subscriptionId value to set.
     * @return the UsageAggregationInner object itself.
     */
    public UsageAggregationInner withSubscriptionId(UUID subscriptionId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UsageSample();
        }
        this.innerProperties().withSubscriptionId(subscriptionId);
        return this;
    }

    /**
     * Get the meterId property: Unique ID for the resource that was consumed (aka ResourceID).
     *
     * @return the meterId value.
     */
    public String meterId() {
        return this.innerProperties() == null ? null : this.innerProperties().meterId();
    }

    /**
     * Set the meterId property: Unique ID for the resource that was consumed (aka ResourceID).
     *
     * @param meterId the meterId value to set.
     * @return the UsageAggregationInner object itself.
     */
    public UsageAggregationInner withMeterId(String meterId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UsageSample();
        }
        this.innerProperties().withMeterId(meterId);
        return this;
    }

    /**
     * Get the usageStartTime property: UTC start time for the usage bucket to which this usage aggregate belongs.
     *
     * @return the usageStartTime value.
     */
    public OffsetDateTime usageStartTime() {
        return this.innerProperties() == null ? null : this.innerProperties().usageStartTime();
    }

    /**
     * Set the usageStartTime property: UTC start time for the usage bucket to which this usage aggregate belongs.
     *
     * @param usageStartTime the usageStartTime value to set.
     * @return the UsageAggregationInner object itself.
     */
    public UsageAggregationInner withUsageStartTime(OffsetDateTime usageStartTime) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UsageSample();
        }
        this.innerProperties().withUsageStartTime(usageStartTime);
        return this;
    }

    /**
     * Get the usageEndTime property: UTC end time for the usage bucket to which this usage aggregate belongs.
     *
     * @return the usageEndTime value.
     */
    public OffsetDateTime usageEndTime() {
        return this.innerProperties() == null ? null : this.innerProperties().usageEndTime();
    }

    /**
     * Set the usageEndTime property: UTC end time for the usage bucket to which this usage aggregate belongs.
     *
     * @param usageEndTime the usageEndTime value to set.
     * @return the UsageAggregationInner object itself.
     */
    public UsageAggregationInner withUsageEndTime(OffsetDateTime usageEndTime) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UsageSample();
        }
        this.innerProperties().withUsageEndTime(usageEndTime);
        return this;
    }

    /**
     * Get the quantity property: The amount of the resource consumption that occurred in this time frame.
     *
     * @return the quantity value.
     */
    public Float quantity() {
        return this.innerProperties() == null ? null : this.innerProperties().quantity();
    }

    /**
     * Set the quantity property: The amount of the resource consumption that occurred in this time frame.
     *
     * @param quantity the quantity value to set.
     * @return the UsageAggregationInner object itself.
     */
    public UsageAggregationInner withQuantity(Float quantity) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UsageSample();
        }
        this.innerProperties().withQuantity(quantity);
        return this;
    }

    /**
     * Get the unit property: The unit in which the usage for this resource is being counted, e.g. Hours, GB.
     *
     * @return the unit value.
     */
    public String unit() {
        return this.innerProperties() == null ? null : this.innerProperties().unit();
    }

    /**
     * Set the unit property: The unit in which the usage for this resource is being counted, e.g. Hours, GB.
     *
     * @param unit the unit value to set.
     * @return the UsageAggregationInner object itself.
     */
    public UsageAggregationInner withUnit(String unit) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UsageSample();
        }
        this.innerProperties().withUnit(unit);
        return this;
    }

    /**
     * Get the meterName property: Friendly name of the resource being consumed.
     *
     * @return the meterName value.
     */
    public String meterName() {
        return this.innerProperties() == null ? null : this.innerProperties().meterName();
    }

    /**
     * Set the meterName property: Friendly name of the resource being consumed.
     *
     * @param meterName the meterName value to set.
     * @return the UsageAggregationInner object itself.
     */
    public UsageAggregationInner withMeterName(String meterName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UsageSample();
        }
        this.innerProperties().withMeterName(meterName);
        return this;
    }

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

    /**
     * Set the meterCategory property: Category of the consumed resource.
     *
     * @param meterCategory the meterCategory value to set.
     * @return the UsageAggregationInner object itself.
     */
    public UsageAggregationInner withMeterCategory(String meterCategory) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UsageSample();
        }
        this.innerProperties().withMeterCategory(meterCategory);
        return this;
    }

    /**
     * Get the meterSubCategory property: Sub-category of the consumed resource.
     *
     * @return the meterSubCategory value.
     */
    public String meterSubCategory() {
        return this.innerProperties() == null ? null : this.innerProperties().meterSubCategory();
    }

    /**
     * Set the meterSubCategory property: Sub-category of the consumed resource.
     *
     * @param meterSubCategory the meterSubCategory value to set.
     * @return the UsageAggregationInner object itself.
     */
    public UsageAggregationInner withMeterSubCategory(String meterSubCategory) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UsageSample();
        }
        this.innerProperties().withMeterSubCategory(meterSubCategory);
        return this;
    }

    /**
     * Get the meterRegion property: Region of the meterId used for billing purposes.
     *
     * @return the meterRegion value.
     */
    public String meterRegion() {
        return this.innerProperties() == null ? null : this.innerProperties().meterRegion();
    }

    /**
     * Set the meterRegion property: Region of the meterId used for billing purposes.
     *
     * @param meterRegion the meterRegion value to set.
     * @return the UsageAggregationInner object itself.
     */
    public UsageAggregationInner withMeterRegion(String meterRegion) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UsageSample();
        }
        this.innerProperties().withMeterRegion(meterRegion);
        return this;
    }

    /**
     * Get the infoFields property: Key-value pairs of instance details (legacy format).
     *
     * @return the infoFields value.
     */
    public InfoField infoFields() {
        return this.innerProperties() == null ? null : this.innerProperties().infoFields();
    }

    /**
     * Set the infoFields property: Key-value pairs of instance details (legacy format).
     *
     * @param infoFields the infoFields value to set.
     * @return the UsageAggregationInner object itself.
     */
    public UsageAggregationInner withInfoFields(InfoField infoFields) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UsageSample();
        }
        this.innerProperties().withInfoFields(infoFields);
        return this;
    }

    /**
     * Get the instanceData property: Key-value pairs of instance details represented as a string.
     *
     * @return the instanceData value.
     */
    public String instanceData() {
        return this.innerProperties() == null ? null : this.innerProperties().instanceData();
    }

    /**
     * Set the instanceData property: Key-value pairs of instance details represented as a string.
     *
     * @param instanceData the instanceData value to set.
     * @return the UsageAggregationInner object itself.
     */
    public UsageAggregationInner withInstanceData(String instanceData) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UsageSample();
        }
        this.innerProperties().withInstanceData(instanceData);
        return this;
    }

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