// 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.models;

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

/** IP Extended Community patchable properties. */
@Fluent
public class IpExtendedCommunityPatchableProperties {
    /*
     * List of IP Extended Community Rules.
     */
    @JsonProperty(value = "ipExtendedCommunityRules", required = true)
    private List<IpExtendedCommunityRule> ipExtendedCommunityRules;

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

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

    /**
     * Set the ipExtendedCommunityRules property: List of IP Extended Community Rules.
     *
     * @param ipExtendedCommunityRules the ipExtendedCommunityRules value to set.
     * @return the IpExtendedCommunityPatchableProperties object itself.
     */
    public IpExtendedCommunityPatchableProperties withIpExtendedCommunityRules(
        List<IpExtendedCommunityRule> ipExtendedCommunityRules) {
        this.ipExtendedCommunityRules = ipExtendedCommunityRules;
        return this;
    }

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

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