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

package com.azure.resourcemanager.security.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/**
 * A rule set which evaluates all its rules upon an event interception. Only when all the included rules in the rule set
 * will be evaluated as 'true', will the event trigger the defined actions.
 */
@Fluent
public final class AutomationRuleSet {
    /*
     * The rules property.
     */
    @JsonProperty(value = "rules")
    private List<AutomationTriggeringRule> rules;

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

    /**
     * Get the rules property: The rules property.
     *
     * @return the rules value.
     */
    public List<AutomationTriggeringRule> rules() {
        return this.rules;
    }

    /**
     * Set the rules property: The rules property.
     *
     * @param rules the rules value to set.
     * @return the AutomationRuleSet object itself.
     */
    public AutomationRuleSet withRules(List<AutomationTriggeringRule> rules) {
        this.rules = rules;
        return this;
    }

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