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

package com.azure.resourcemanager.databoxedge.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Metric specification version 1. */
@Fluent
public final class MetricSpecificationV1 {
    /*
     * Name of the metric.
     */
    @JsonProperty(value = "name")
    private String name;

    /*
     * Display name of the metric.
     */
    @JsonProperty(value = "displayName")
    private String displayName;

    /*
     * Description of the metric to be displayed.
     */
    @JsonProperty(value = "displayDescription")
    private String displayDescription;

    /*
     * Metric units.
     */
    @JsonProperty(value = "unit")
    private MetricUnit unit;

    /*
     * Metric aggregation type.
     */
    @JsonProperty(value = "aggregationType")
    private MetricAggregationType aggregationType;

    /*
     * Metric dimensions, other than default dimension which is resource.
     */
    @JsonProperty(value = "dimensions")
    private List<MetricDimensionV1> dimensions;

    /*
     * Set true to fill the gaps with zero.
     */
    @JsonProperty(value = "fillGapWithZero")
    private Boolean fillGapWithZero;

    /*
     * Metric category.
     */
    @JsonProperty(value = "category")
    private MetricCategory category;

    /*
     * Resource name override.
     */
    @JsonProperty(value = "resourceIdDimensionNameOverride")
    private String resourceIdDimensionNameOverride;

    /*
     * Support granularity of metrics.
     */
    @JsonProperty(value = "supportedTimeGrainTypes")
    private List<TimeGrain> supportedTimeGrainTypes;

    /*
     * Support metric aggregation type.
     */
    @JsonProperty(value = "supportedAggregationTypes")
    private List<MetricAggregationType> supportedAggregationTypes;

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

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

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

    /**
     * Get the displayName property: Display name of the metric.
     *
     * @return the displayName value.
     */
    public String displayName() {
        return this.displayName;
    }

    /**
     * Set the displayName property: Display name of the metric.
     *
     * @param displayName the displayName value to set.
     * @return the MetricSpecificationV1 object itself.
     */
    public MetricSpecificationV1 withDisplayName(String displayName) {
        this.displayName = displayName;
        return this;
    }

    /**
     * Get the displayDescription property: Description of the metric to be displayed.
     *
     * @return the displayDescription value.
     */
    public String displayDescription() {
        return this.displayDescription;
    }

    /**
     * Set the displayDescription property: Description of the metric to be displayed.
     *
     * @param displayDescription the displayDescription value to set.
     * @return the MetricSpecificationV1 object itself.
     */
    public MetricSpecificationV1 withDisplayDescription(String displayDescription) {
        this.displayDescription = displayDescription;
        return this;
    }

    /**
     * Get the unit property: Metric units.
     *
     * @return the unit value.
     */
    public MetricUnit unit() {
        return this.unit;
    }

    /**
     * Set the unit property: Metric units.
     *
     * @param unit the unit value to set.
     * @return the MetricSpecificationV1 object itself.
     */
    public MetricSpecificationV1 withUnit(MetricUnit unit) {
        this.unit = unit;
        return this;
    }

    /**
     * Get the aggregationType property: Metric aggregation type.
     *
     * @return the aggregationType value.
     */
    public MetricAggregationType aggregationType() {
        return this.aggregationType;
    }

    /**
     * Set the aggregationType property: Metric aggregation type.
     *
     * @param aggregationType the aggregationType value to set.
     * @return the MetricSpecificationV1 object itself.
     */
    public MetricSpecificationV1 withAggregationType(MetricAggregationType aggregationType) {
        this.aggregationType = aggregationType;
        return this;
    }

    /**
     * Get the dimensions property: Metric dimensions, other than default dimension which is resource.
     *
     * @return the dimensions value.
     */
    public List<MetricDimensionV1> dimensions() {
        return this.dimensions;
    }

    /**
     * Set the dimensions property: Metric dimensions, other than default dimension which is resource.
     *
     * @param dimensions the dimensions value to set.
     * @return the MetricSpecificationV1 object itself.
     */
    public MetricSpecificationV1 withDimensions(List<MetricDimensionV1> dimensions) {
        this.dimensions = dimensions;
        return this;
    }

    /**
     * Get the fillGapWithZero property: Set true to fill the gaps with zero.
     *
     * @return the fillGapWithZero value.
     */
    public Boolean fillGapWithZero() {
        return this.fillGapWithZero;
    }

    /**
     * Set the fillGapWithZero property: Set true to fill the gaps with zero.
     *
     * @param fillGapWithZero the fillGapWithZero value to set.
     * @return the MetricSpecificationV1 object itself.
     */
    public MetricSpecificationV1 withFillGapWithZero(Boolean fillGapWithZero) {
        this.fillGapWithZero = fillGapWithZero;
        return this;
    }

    /**
     * Get the category property: Metric category.
     *
     * @return the category value.
     */
    public MetricCategory category() {
        return this.category;
    }

    /**
     * Set the category property: Metric category.
     *
     * @param category the category value to set.
     * @return the MetricSpecificationV1 object itself.
     */
    public MetricSpecificationV1 withCategory(MetricCategory category) {
        this.category = category;
        return this;
    }

    /**
     * Get the resourceIdDimensionNameOverride property: Resource name override.
     *
     * @return the resourceIdDimensionNameOverride value.
     */
    public String resourceIdDimensionNameOverride() {
        return this.resourceIdDimensionNameOverride;
    }

    /**
     * Set the resourceIdDimensionNameOverride property: Resource name override.
     *
     * @param resourceIdDimensionNameOverride the resourceIdDimensionNameOverride value to set.
     * @return the MetricSpecificationV1 object itself.
     */
    public MetricSpecificationV1 withResourceIdDimensionNameOverride(String resourceIdDimensionNameOverride) {
        this.resourceIdDimensionNameOverride = resourceIdDimensionNameOverride;
        return this;
    }

    /**
     * Get the supportedTimeGrainTypes property: Support granularity of metrics.
     *
     * @return the supportedTimeGrainTypes value.
     */
    public List<TimeGrain> supportedTimeGrainTypes() {
        return this.supportedTimeGrainTypes;
    }

    /**
     * Set the supportedTimeGrainTypes property: Support granularity of metrics.
     *
     * @param supportedTimeGrainTypes the supportedTimeGrainTypes value to set.
     * @return the MetricSpecificationV1 object itself.
     */
    public MetricSpecificationV1 withSupportedTimeGrainTypes(List<TimeGrain> supportedTimeGrainTypes) {
        this.supportedTimeGrainTypes = supportedTimeGrainTypes;
        return this;
    }

    /**
     * Get the supportedAggregationTypes property: Support metric aggregation type.
     *
     * @return the supportedAggregationTypes value.
     */
    public List<MetricAggregationType> supportedAggregationTypes() {
        return this.supportedAggregationTypes;
    }

    /**
     * Set the supportedAggregationTypes property: Support metric aggregation type.
     *
     * @param supportedAggregationTypes the supportedAggregationTypes value to set.
     * @return the MetricSpecificationV1 object itself.
     */
    public MetricSpecificationV1 withSupportedAggregationTypes(List<MetricAggregationType> supportedAggregationTypes) {
        this.supportedAggregationTypes = supportedAggregationTypes;
        return this;
    }

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