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

package com.azure.resourcemanager.alertsmanagement.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.util.List;

/** Monitor service details. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "metadataIdentifier")
@JsonTypeName("MonitorServiceList")
@Fluent
public final class MonitorServiceList extends AlertsMetadataProperties {
    /*
     * Array of operations
     */
    @JsonProperty(value = "data", required = true)
    private List<MonitorServiceDetails> data;

    /**
     * Get the data property: Array of operations.
     *
     * @return the data value.
     */
    public List<MonitorServiceDetails> data() {
        return this.data;
    }

    /**
     * Set the data property: Array of operations.
     *
     * @param data the data value to set.
     * @return the MonitorServiceList object itself.
     */
    public MonitorServiceList withData(List<MonitorServiceDetails> data) {
        this.data = data;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        super.validate();
        if (data() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property data in model MonitorServiceList"));
        } else {
            data().forEach(e -> e.validate());
        }
    }

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