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

package com.azure.resourcemanager.policyinsights.models;

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

/** Policy evaluation details. */
@Fluent
public final class PolicyEvaluationDetails {
    /*
     * Details of the evaluated expressions.
     */
    @JsonProperty(value = "evaluatedExpressions")
    private List<ExpressionEvaluationDetails> evaluatedExpressions;

    /*
     * Evaluation details of IfNotExists effect.
     */
    @JsonProperty(value = "ifNotExistsDetails")
    private IfNotExistsEvaluationDetails ifNotExistsDetails;

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

    /**
     * Get the evaluatedExpressions property: Details of the evaluated expressions.
     *
     * @return the evaluatedExpressions value.
     */
    public List<ExpressionEvaluationDetails> evaluatedExpressions() {
        return this.evaluatedExpressions;
    }

    /**
     * Set the evaluatedExpressions property: Details of the evaluated expressions.
     *
     * @param evaluatedExpressions the evaluatedExpressions value to set.
     * @return the PolicyEvaluationDetails object itself.
     */
    public PolicyEvaluationDetails withEvaluatedExpressions(List<ExpressionEvaluationDetails> evaluatedExpressions) {
        this.evaluatedExpressions = evaluatedExpressions;
        return this;
    }

    /**
     * Get the ifNotExistsDetails property: Evaluation details of IfNotExists effect.
     *
     * @return the ifNotExistsDetails value.
     */
    public IfNotExistsEvaluationDetails ifNotExistsDetails() {
        return this.ifNotExistsDetails;
    }

    /**
     * Set the ifNotExistsDetails property: Evaluation details of IfNotExists effect.
     *
     * @param ifNotExistsDetails the ifNotExistsDetails value to set.
     * @return the PolicyEvaluationDetails object itself.
     */
    public PolicyEvaluationDetails withIfNotExistsDetails(IfNotExistsEvaluationDetails ifNotExistsDetails) {
        this.ifNotExistsDetails = ifNotExistsDetails;
        return this;
    }

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