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

package com.azure.resourcemanager.elastic.models;

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

/** Elastic traffic filter object. */
@Fluent
public final class ElasticTrafficFilter {
    /*
     * Id of the elastic filter
     */
    @JsonProperty(value = "id")
    private String id;

    /*
     * Name of the elastic filter
     */
    @JsonProperty(value = "name")
    private String name;

    /*
     * Description of the elastic filter
     */
    @JsonProperty(value = "description")
    private String description;

    /*
     * Region of the elastic filter
     */
    @JsonProperty(value = "region")
    private String region;

    /*
     * Type of the elastic filter
     */
    @JsonProperty(value = "type")
    private Type type;

    /*
     * IncludeByDefault for the elastic filter
     */
    @JsonProperty(value = "includeByDefault")
    private Boolean includeByDefault;

    /*
     * Rules in the elastic filter
     */
    @JsonProperty(value = "rules")
    private List<ElasticTrafficFilterRule> rules;

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

    /**
     * Get the id property: Id of the elastic filter.
     *
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

    /**
     * Set the id property: Id of the elastic filter.
     *
     * @param id the id value to set.
     * @return the ElasticTrafficFilter object itself.
     */
    public ElasticTrafficFilter withId(String id) {
        this.id = id;
        return this;
    }

    /**
     * Get the name property: Name of the elastic filter.
     *
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: Name of the elastic filter.
     *
     * @param name the name value to set.
     * @return the ElasticTrafficFilter object itself.
     */
    public ElasticTrafficFilter withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the description property: Description of the elastic filter.
     *
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

    /**
     * Set the description property: Description of the elastic filter.
     *
     * @param description the description value to set.
     * @return the ElasticTrafficFilter object itself.
     */
    public ElasticTrafficFilter withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Get the region property: Region of the elastic filter.
     *
     * @return the region value.
     */
    public String region() {
        return this.region;
    }

    /**
     * Set the region property: Region of the elastic filter.
     *
     * @param region the region value to set.
     * @return the ElasticTrafficFilter object itself.
     */
    public ElasticTrafficFilter withRegion(String region) {
        this.region = region;
        return this;
    }

    /**
     * Get the type property: Type of the elastic filter.
     *
     * @return the type value.
     */
    public Type type() {
        return this.type;
    }

    /**
     * Set the type property: Type of the elastic filter.
     *
     * @param type the type value to set.
     * @return the ElasticTrafficFilter object itself.
     */
    public ElasticTrafficFilter withType(Type type) {
        this.type = type;
        return this;
    }

    /**
     * Get the includeByDefault property: IncludeByDefault for the elastic filter.
     *
     * @return the includeByDefault value.
     */
    public Boolean includeByDefault() {
        return this.includeByDefault;
    }

    /**
     * Set the includeByDefault property: IncludeByDefault for the elastic filter.
     *
     * @param includeByDefault the includeByDefault value to set.
     * @return the ElasticTrafficFilter object itself.
     */
    public ElasticTrafficFilter withIncludeByDefault(Boolean includeByDefault) {
        this.includeByDefault = includeByDefault;
        return this;
    }

    /**
     * Get the rules property: Rules in the elastic filter.
     *
     * @return the rules value.
     */
    public List<ElasticTrafficFilterRule> rules() {
        return this.rules;
    }

    /**
     * Set the rules property: Rules in the elastic filter.
     *
     * @param rules the rules value to set.
     * @return the ElasticTrafficFilter object itself.
     */
    public ElasticTrafficFilter withRules(List<ElasticTrafficFilterRule> 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());
        }
    }
}
