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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;

/** The properties for input to get top query statistics. */
@Fluent
public final class TopQueryStatisticsInputProperties {
    /*
     * Max number of top queries to return.
     */
    @JsonProperty(value = "numberOfTopQueries", required = true)
    private int numberOfTopQueries;

    /*
     * Aggregation function name.
     */
    @JsonProperty(value = "aggregationFunction", required = true)
    private String aggregationFunction;

    /*
     * Observed metric name.
     */
    @JsonProperty(value = "observedMetric", required = true)
    private String observedMetric;

    /*
     * Observation start time.
     */
    @JsonProperty(value = "observationStartTime", required = true)
    private OffsetDateTime observationStartTime;

    /*
     * Observation end time.
     */
    @JsonProperty(value = "observationEndTime", required = true)
    private OffsetDateTime observationEndTime;

    /*
     * Aggregation interval type in ISO 8601 format.
     */
    @JsonProperty(value = "aggregationWindow", required = true)
    private String aggregationWindow;

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

    /**
     * Get the numberOfTopQueries property: Max number of top queries to return.
     *
     * @return the numberOfTopQueries value.
     */
    public int numberOfTopQueries() {
        return this.numberOfTopQueries;
    }

    /**
     * Set the numberOfTopQueries property: Max number of top queries to return.
     *
     * @param numberOfTopQueries the numberOfTopQueries value to set.
     * @return the TopQueryStatisticsInputProperties object itself.
     */
    public TopQueryStatisticsInputProperties withNumberOfTopQueries(int numberOfTopQueries) {
        this.numberOfTopQueries = numberOfTopQueries;
        return this;
    }

    /**
     * Get the aggregationFunction property: Aggregation function name.
     *
     * @return the aggregationFunction value.
     */
    public String aggregationFunction() {
        return this.aggregationFunction;
    }

    /**
     * Set the aggregationFunction property: Aggregation function name.
     *
     * @param aggregationFunction the aggregationFunction value to set.
     * @return the TopQueryStatisticsInputProperties object itself.
     */
    public TopQueryStatisticsInputProperties withAggregationFunction(String aggregationFunction) {
        this.aggregationFunction = aggregationFunction;
        return this;
    }

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

    /**
     * Set the observedMetric property: Observed metric name.
     *
     * @param observedMetric the observedMetric value to set.
     * @return the TopQueryStatisticsInputProperties object itself.
     */
    public TopQueryStatisticsInputProperties withObservedMetric(String observedMetric) {
        this.observedMetric = observedMetric;
        return this;
    }

    /**
     * Get the observationStartTime property: Observation start time.
     *
     * @return the observationStartTime value.
     */
    public OffsetDateTime observationStartTime() {
        return this.observationStartTime;
    }

    /**
     * Set the observationStartTime property: Observation start time.
     *
     * @param observationStartTime the observationStartTime value to set.
     * @return the TopQueryStatisticsInputProperties object itself.
     */
    public TopQueryStatisticsInputProperties withObservationStartTime(OffsetDateTime observationStartTime) {
        this.observationStartTime = observationStartTime;
        return this;
    }

    /**
     * Get the observationEndTime property: Observation end time.
     *
     * @return the observationEndTime value.
     */
    public OffsetDateTime observationEndTime() {
        return this.observationEndTime;
    }

    /**
     * Set the observationEndTime property: Observation end time.
     *
     * @param observationEndTime the observationEndTime value to set.
     * @return the TopQueryStatisticsInputProperties object itself.
     */
    public TopQueryStatisticsInputProperties withObservationEndTime(OffsetDateTime observationEndTime) {
        this.observationEndTime = observationEndTime;
        return this;
    }

    /**
     * Get the aggregationWindow property: Aggregation interval type in ISO 8601 format.
     *
     * @return the aggregationWindow value.
     */
    public String aggregationWindow() {
        return this.aggregationWindow;
    }

    /**
     * Set the aggregationWindow property: Aggregation interval type in ISO 8601 format.
     *
     * @param aggregationWindow the aggregationWindow value to set.
     * @return the TopQueryStatisticsInputProperties object itself.
     */
    public TopQueryStatisticsInputProperties withAggregationWindow(String aggregationWindow) {
        this.aggregationWindow = aggregationWindow;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (aggregationFunction() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property aggregationFunction in model TopQueryStatisticsInputProperties"));
        }
        if (observedMetric() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property observedMetric in model TopQueryStatisticsInputProperties"));
        }
        if (observationStartTime() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property observationStartTime in model TopQueryStatisticsInputProperties"));
        }
        if (observationEndTime() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property observationEndTime in model TopQueryStatisticsInputProperties"));
        }
        if (aggregationWindow() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property aggregationWindow in model TopQueryStatisticsInputProperties"));
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(TopQueryStatisticsInputProperties.class);
}
