// 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.AbnormalTimePeriod;
import com.azure.resourcemanager.appservice.models.AnalysisData;
import com.azure.resourcemanager.appservice.models.ProxyOnlyResource;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;

/** Class representing a diagnostic analysis done on an application. */
@Fluent
public final class DiagnosticAnalysisInner extends ProxyOnlyResource {
    /*
     * DiagnosticAnalysis resource specific properties
     */
    @JsonProperty(value = "properties")
    private DiagnosticAnalysisProperties innerProperties;

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

    /**
     * Get the innerProperties property: DiagnosticAnalysis resource specific properties.
     *
     * @return the innerProperties value.
     */
    private DiagnosticAnalysisProperties innerProperties() {
        return this.innerProperties;
    }

    /** {@inheritDoc} */
    @Override
    public DiagnosticAnalysisInner withKind(String kind) {
        super.withKind(kind);
        return this;
    }

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

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

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

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

    /**
     * Get the abnormalTimePeriods property: List of time periods.
     *
     * @return the abnormalTimePeriods value.
     */
    public List<AbnormalTimePeriod> abnormalTimePeriods() {
        return this.innerProperties() == null ? null : this.innerProperties().abnormalTimePeriods();
    }

    /**
     * Set the abnormalTimePeriods property: List of time periods.
     *
     * @param abnormalTimePeriods the abnormalTimePeriods value to set.
     * @return the DiagnosticAnalysisInner object itself.
     */
    public DiagnosticAnalysisInner withAbnormalTimePeriods(List<AbnormalTimePeriod> abnormalTimePeriods) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DiagnosticAnalysisProperties();
        }
        this.innerProperties().withAbnormalTimePeriods(abnormalTimePeriods);
        return this;
    }

    /**
     * Get the payload property: Data by each detector.
     *
     * @return the payload value.
     */
    public List<AnalysisData> payload() {
        return this.innerProperties() == null ? null : this.innerProperties().payload();
    }

    /**
     * Set the payload property: Data by each detector.
     *
     * @param payload the payload value to set.
     * @return the DiagnosticAnalysisInner object itself.
     */
    public DiagnosticAnalysisInner withPayload(List<AnalysisData> payload) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DiagnosticAnalysisProperties();
        }
        this.innerProperties().withPayload(payload);
        return this;
    }

    /**
     * Get the nonCorrelatedDetectors property: Data by each detector for detectors that did not corelate.
     *
     * @return the nonCorrelatedDetectors value.
     */
    public List<DetectorDefinition> nonCorrelatedDetectors() {
        return this.innerProperties() == null ? null : this.innerProperties().nonCorrelatedDetectors();
    }

    /**
     * Set the nonCorrelatedDetectors property: Data by each detector for detectors that did not corelate.
     *
     * @param nonCorrelatedDetectors the nonCorrelatedDetectors value to set.
     * @return the DiagnosticAnalysisInner object itself.
     */
    public DiagnosticAnalysisInner withNonCorrelatedDetectors(List<DetectorDefinition> nonCorrelatedDetectors) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DiagnosticAnalysisProperties();
        }
        this.innerProperties().withNonCorrelatedDetectors(nonCorrelatedDetectors);
        return this;
    }

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