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

package com.azure.resourcemanager.networkcloud.models;

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

/** AttachedNetworkConfiguration represents the set of workload networks to attach to a resource. */
@Fluent
public final class AttachedNetworkConfiguration {
    /*
     * The list of Layer 2 Networks and related configuration for attachment.
     */
    @JsonProperty(value = "l2Networks")
    private List<L2NetworkAttachmentConfiguration> l2Networks;

    /*
     * The list of Layer 3 Networks and related configuration for attachment.
     */
    @JsonProperty(value = "l3Networks")
    private List<L3NetworkAttachmentConfiguration> l3Networks;

    /*
     * The list of Trunked Networks and related configuration for attachment.
     */
    @JsonProperty(value = "trunkedNetworks")
    private List<TrunkedNetworkAttachmentConfiguration> trunkedNetworks;

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

    /**
     * Get the l2Networks property: The list of Layer 2 Networks and related configuration for attachment.
     *
     * @return the l2Networks value.
     */
    public List<L2NetworkAttachmentConfiguration> l2Networks() {
        return this.l2Networks;
    }

    /**
     * Set the l2Networks property: The list of Layer 2 Networks and related configuration for attachment.
     *
     * @param l2Networks the l2Networks value to set.
     * @return the AttachedNetworkConfiguration object itself.
     */
    public AttachedNetworkConfiguration withL2Networks(List<L2NetworkAttachmentConfiguration> l2Networks) {
        this.l2Networks = l2Networks;
        return this;
    }

    /**
     * Get the l3Networks property: The list of Layer 3 Networks and related configuration for attachment.
     *
     * @return the l3Networks value.
     */
    public List<L3NetworkAttachmentConfiguration> l3Networks() {
        return this.l3Networks;
    }

    /**
     * Set the l3Networks property: The list of Layer 3 Networks and related configuration for attachment.
     *
     * @param l3Networks the l3Networks value to set.
     * @return the AttachedNetworkConfiguration object itself.
     */
    public AttachedNetworkConfiguration withL3Networks(List<L3NetworkAttachmentConfiguration> l3Networks) {
        this.l3Networks = l3Networks;
        return this;
    }

    /**
     * Get the trunkedNetworks property: The list of Trunked Networks and related configuration for attachment.
     *
     * @return the trunkedNetworks value.
     */
    public List<TrunkedNetworkAttachmentConfiguration> trunkedNetworks() {
        return this.trunkedNetworks;
    }

    /**
     * Set the trunkedNetworks property: The list of Trunked Networks and related configuration for attachment.
     *
     * @param trunkedNetworks the trunkedNetworks value to set.
     * @return the AttachedNetworkConfiguration object itself.
     */
    public AttachedNetworkConfiguration withTrunkedNetworks(
        List<TrunkedNetworkAttachmentConfiguration> trunkedNetworks) {
        this.trunkedNetworks = trunkedNetworks;
        return this;
    }

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