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

package com.azure.resourcemanager.managednetworkfabric.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.managednetworkfabric.models.IpCommunityRule;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** IP Community patchable properties. */
@Fluent
public class IpCommunityPatchableProperties {
    /*
     * List of IP Community Rules.
     */
    @JsonProperty(value = "ipCommunityRules")
    private List<IpCommunityRule> ipCommunityRules;

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

    /**
     * Get the ipCommunityRules property: List of IP Community Rules.
     *
     * @return the ipCommunityRules value.
     */
    public List<IpCommunityRule> ipCommunityRules() {
        return this.ipCommunityRules;
    }

    /**
     * Set the ipCommunityRules property: List of IP Community Rules.
     *
     * @param ipCommunityRules the ipCommunityRules value to set.
     * @return the IpCommunityPatchableProperties object itself.
     */
    public IpCommunityPatchableProperties withIpCommunityRules(List<IpCommunityRule> ipCommunityRules) {
        this.ipCommunityRules = ipCommunityRules;
        return this;
    }

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