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

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

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.appservice.models.DetectorAbnormalTimePeriod;
import com.azure.resourcemanager.appservice.models.DiagnosticMetricSet;
import com.azure.resourcemanager.appservice.models.NameValuePair;
import com.azure.resourcemanager.appservice.models.ResponseMetadata;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;

/** DiagnosticDetectorResponse resource specific properties. */
@Fluent
public final class DiagnosticDetectorResponseProperties {
    /*
     * Start time of the period
     */
    @JsonProperty(value = "startTime")
    private OffsetDateTime startTime;

    /*
     * End time of the period
     */
    @JsonProperty(value = "endTime")
    private OffsetDateTime endTime;

    /*
     * Flag representing Issue was detected.
     */
    @JsonProperty(value = "issueDetected")
    private Boolean issueDetected;

    /*
     * Detector's definition
     */
    @JsonProperty(value = "detectorDefinition")
    private DetectorDefinition detectorDefinition;

    /*
     * Metrics provided by the detector
     */
    @JsonProperty(value = "metrics")
    private List<DiagnosticMetricSet> metrics;

    /*
     * List of Correlated events found by the detector
     */
    @JsonProperty(value = "abnormalTimePeriods")
    private List<DetectorAbnormalTimePeriod> abnormalTimePeriods;

    /*
     * Additional Data that detector wants to send.
     */
    @JsonProperty(value = "data")
    private List<List<NameValuePair>> data;

    /*
     * Meta Data
     */
    @JsonProperty(value = "responseMetaData")
    private ResponseMetadata responseMetadata;

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

    /**
     * Get the startTime property: Start time of the period.
     *
     * @return the startTime value.
     */
    public OffsetDateTime startTime() {
        return this.startTime;
    }

    /**
     * Set the startTime property: Start time of the period.
     *
     * @param startTime the startTime value to set.
     * @return the DiagnosticDetectorResponseProperties object itself.
     */
    public DiagnosticDetectorResponseProperties withStartTime(OffsetDateTime startTime) {
        this.startTime = startTime;
        return this;
    }

    /**
     * Get the endTime property: End time of the period.
     *
     * @return the endTime value.
     */
    public OffsetDateTime endTime() {
        return this.endTime;
    }

    /**
     * Set the endTime property: End time of the period.
     *
     * @param endTime the endTime value to set.
     * @return the DiagnosticDetectorResponseProperties object itself.
     */
    public DiagnosticDetectorResponseProperties withEndTime(OffsetDateTime endTime) {
        this.endTime = endTime;
        return this;
    }

    /**
     * Get the issueDetected property: Flag representing Issue was detected.
     *
     * @return the issueDetected value.
     */
    public Boolean issueDetected() {
        return this.issueDetected;
    }

    /**
     * Set the issueDetected property: Flag representing Issue was detected.
     *
     * @param issueDetected the issueDetected value to set.
     * @return the DiagnosticDetectorResponseProperties object itself.
     */
    public DiagnosticDetectorResponseProperties withIssueDetected(Boolean issueDetected) {
        this.issueDetected = issueDetected;
        return this;
    }

    /**
     * Get the detectorDefinition property: Detector's definition.
     *
     * @return the detectorDefinition value.
     */
    public DetectorDefinition detectorDefinition() {
        return this.detectorDefinition;
    }

    /**
     * Set the detectorDefinition property: Detector's definition.
     *
     * @param detectorDefinition the detectorDefinition value to set.
     * @return the DiagnosticDetectorResponseProperties object itself.
     */
    public DiagnosticDetectorResponseProperties withDetectorDefinition(DetectorDefinition detectorDefinition) {
        this.detectorDefinition = detectorDefinition;
        return this;
    }

    /**
     * Get the metrics property: Metrics provided by the detector.
     *
     * @return the metrics value.
     */
    public List<DiagnosticMetricSet> metrics() {
        return this.metrics;
    }

    /**
     * Set the metrics property: Metrics provided by the detector.
     *
     * @param metrics the metrics value to set.
     * @return the DiagnosticDetectorResponseProperties object itself.
     */
    public DiagnosticDetectorResponseProperties withMetrics(List<DiagnosticMetricSet> metrics) {
        this.metrics = metrics;
        return this;
    }

    /**
     * Get the abnormalTimePeriods property: List of Correlated events found by the detector.
     *
     * @return the abnormalTimePeriods value.
     */
    public List<DetectorAbnormalTimePeriod> abnormalTimePeriods() {
        return this.abnormalTimePeriods;
    }

    /**
     * Set the abnormalTimePeriods property: List of Correlated events found by the detector.
     *
     * @param abnormalTimePeriods the abnormalTimePeriods value to set.
     * @return the DiagnosticDetectorResponseProperties object itself.
     */
    public DiagnosticDetectorResponseProperties withAbnormalTimePeriods(
        List<DetectorAbnormalTimePeriod> abnormalTimePeriods) {
        this.abnormalTimePeriods = abnormalTimePeriods;
        return this;
    }

    /**
     * Get the data property: Additional Data that detector wants to send.
     *
     * @return the data value.
     */
    public List<List<NameValuePair>> data() {
        return this.data;
    }

    /**
     * Set the data property: Additional Data that detector wants to send.
     *
     * @param data the data value to set.
     * @return the DiagnosticDetectorResponseProperties object itself.
     */
    public DiagnosticDetectorResponseProperties withData(List<List<NameValuePair>> data) {
        this.data = data;
        return this;
    }

    /**
     * Get the responseMetadata property: Meta Data.
     *
     * @return the responseMetadata value.
     */
    public ResponseMetadata responseMetadata() {
        return this.responseMetadata;
    }

    /**
     * Set the responseMetadata property: Meta Data.
     *
     * @param responseMetadata the responseMetadata value to set.
     * @return the DiagnosticDetectorResponseProperties object itself.
     */
    public DiagnosticDetectorResponseProperties withResponseMetadata(ResponseMetadata responseMetadata) {
        this.responseMetadata = responseMetadata;
        return this;
    }

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