// 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.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Dynamic match configuration object. */
@Fluent
public final class CommonDynamicMatchConfiguration {
    /*
     * List of IP Groups.
     */
    @JsonProperty(value = "ipGroups")
    private List<IpGroupProperties> ipGroups;

    /*
     * List of vlan groups.
     */
    @JsonProperty(value = "vlanGroups")
    private List<VlanGroupProperties> vlanGroups;

    /*
     * List of the port group.
     */
    @JsonProperty(value = "portGroups")
    private List<PortGroupProperties> portGroups;

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

    /**
     * Get the ipGroups property: List of IP Groups.
     *
     * @return the ipGroups value.
     */
    public List<IpGroupProperties> ipGroups() {
        return this.ipGroups;
    }

    /**
     * Set the ipGroups property: List of IP Groups.
     *
     * @param ipGroups the ipGroups value to set.
     * @return the CommonDynamicMatchConfiguration object itself.
     */
    public CommonDynamicMatchConfiguration withIpGroups(List<IpGroupProperties> ipGroups) {
        this.ipGroups = ipGroups;
        return this;
    }

    /**
     * Get the vlanGroups property: List of vlan groups.
     *
     * @return the vlanGroups value.
     */
    public List<VlanGroupProperties> vlanGroups() {
        return this.vlanGroups;
    }

    /**
     * Set the vlanGroups property: List of vlan groups.
     *
     * @param vlanGroups the vlanGroups value to set.
     * @return the CommonDynamicMatchConfiguration object itself.
     */
    public CommonDynamicMatchConfiguration withVlanGroups(List<VlanGroupProperties> vlanGroups) {
        this.vlanGroups = vlanGroups;
        return this;
    }

    /**
     * Get the portGroups property: List of the port group.
     *
     * @return the portGroups value.
     */
    public List<PortGroupProperties> portGroups() {
        return this.portGroups;
    }

    /**
     * Set the portGroups property: List of the port group.
     *
     * @param portGroups the portGroups value to set.
     * @return the CommonDynamicMatchConfiguration object itself.
     */
    public CommonDynamicMatchConfiguration withPortGroups(List<PortGroupProperties> portGroups) {
        this.portGroups = portGroups;
        return this;
    }

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