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

package com.azure.resourcemanager.mysql.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.mysql.fluent.models.WaitStatisticsInputProperties;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;

/** Input to get wait statistics. */
@Fluent
public final class WaitStatisticsInput {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(WaitStatisticsInput.class);

    /*
     * The properties of a wait statistics input.
     */
    @JsonProperty(value = "properties", required = true)
    private WaitStatisticsInputProperties innerProperties = new WaitStatisticsInputProperties();

    /**
     * Get the innerProperties property: The properties of a wait statistics input.
     *
     * @return the innerProperties value.
     */
    private WaitStatisticsInputProperties innerProperties() {
        return this.innerProperties;
    }

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

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

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

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

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

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

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