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

package com.azure.resourcemanager.batchai.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Performance counters reporting settings. */
@Fluent
public final class PerformanceCountersSettings {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(PerformanceCountersSettings.class);

    /*
     * Azure Application Insights information for performance counters
     * reporting. If provided, Batch AI will upload node performance counters
     * to the corresponding Azure Application Insights account.
     */
    @JsonProperty(value = "appInsightsReference", required = true)
    private AppInsightsReference appInsightsReference;

    /**
     * Get the appInsightsReference property: Azure Application Insights information for performance counters reporting.
     * If provided, Batch AI will upload node performance counters to the corresponding Azure Application Insights
     * account.
     *
     * @return the appInsightsReference value.
     */
    public AppInsightsReference appInsightsReference() {
        return this.appInsightsReference;
    }

    /**
     * Set the appInsightsReference property: Azure Application Insights information for performance counters reporting.
     * If provided, Batch AI will upload node performance counters to the corresponding Azure Application Insights
     * account.
     *
     * @param appInsightsReference the appInsightsReference value to set.
     * @return the PerformanceCountersSettings object itself.
     */
    public PerformanceCountersSettings withAppInsightsReference(AppInsightsReference appInsightsReference) {
        this.appInsightsReference = appInsightsReference;
        return this;
    }

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