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

/** BgpServiceLoadBalancerConfiguration represents the configuration of a BGP service load balancer. */
@Fluent
public final class BgpServiceLoadBalancerConfiguration {
    /*
     * The association of IP address pools to the communities and peers, allowing for announcement of IPs.
     */
    @JsonProperty(value = "bgpAdvertisements")
    private List<BgpAdvertisement> bgpAdvertisements;

    /*
     * The list of additional BgpPeer entities that the Kubernetes cluster will peer with. All peering must be
     * explicitly defined.
     */
    @JsonProperty(value = "bgpPeers")
    private List<ServiceLoadBalancerBgpPeer> bgpPeers;

    /*
     * The indicator to specify if the load balancer peers with the network fabric.
     */
    @JsonProperty(value = "fabricPeeringEnabled")
    private FabricPeeringEnabled fabricPeeringEnabled;

    /*
     * The list of pools of IP addresses that can be allocated to Load Balancer services.
     */
    @JsonProperty(value = "ipAddressPools")
    private List<IpAddressPool> ipAddressPools;

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

    /**
     * Get the bgpAdvertisements property: The association of IP address pools to the communities and peers, allowing
     * for announcement of IPs.
     *
     * @return the bgpAdvertisements value.
     */
    public List<BgpAdvertisement> bgpAdvertisements() {
        return this.bgpAdvertisements;
    }

    /**
     * Set the bgpAdvertisements property: The association of IP address pools to the communities and peers, allowing
     * for announcement of IPs.
     *
     * @param bgpAdvertisements the bgpAdvertisements value to set.
     * @return the BgpServiceLoadBalancerConfiguration object itself.
     */
    public BgpServiceLoadBalancerConfiguration withBgpAdvertisements(List<BgpAdvertisement> bgpAdvertisements) {
        this.bgpAdvertisements = bgpAdvertisements;
        return this;
    }

    /**
     * Get the bgpPeers property: The list of additional BgpPeer entities that the Kubernetes cluster will peer with.
     * All peering must be explicitly defined.
     *
     * @return the bgpPeers value.
     */
    public List<ServiceLoadBalancerBgpPeer> bgpPeers() {
        return this.bgpPeers;
    }

    /**
     * Set the bgpPeers property: The list of additional BgpPeer entities that the Kubernetes cluster will peer with.
     * All peering must be explicitly defined.
     *
     * @param bgpPeers the bgpPeers value to set.
     * @return the BgpServiceLoadBalancerConfiguration object itself.
     */
    public BgpServiceLoadBalancerConfiguration withBgpPeers(List<ServiceLoadBalancerBgpPeer> bgpPeers) {
        this.bgpPeers = bgpPeers;
        return this;
    }

    /**
     * Get the fabricPeeringEnabled property: The indicator to specify if the load balancer peers with the network
     * fabric.
     *
     * @return the fabricPeeringEnabled value.
     */
    public FabricPeeringEnabled fabricPeeringEnabled() {
        return this.fabricPeeringEnabled;
    }

    /**
     * Set the fabricPeeringEnabled property: The indicator to specify if the load balancer peers with the network
     * fabric.
     *
     * @param fabricPeeringEnabled the fabricPeeringEnabled value to set.
     * @return the BgpServiceLoadBalancerConfiguration object itself.
     */
    public BgpServiceLoadBalancerConfiguration withFabricPeeringEnabled(FabricPeeringEnabled fabricPeeringEnabled) {
        this.fabricPeeringEnabled = fabricPeeringEnabled;
        return this;
    }

    /**
     * Get the ipAddressPools property: The list of pools of IP addresses that can be allocated to Load Balancer
     * services.
     *
     * @return the ipAddressPools value.
     */
    public List<IpAddressPool> ipAddressPools() {
        return this.ipAddressPools;
    }

    /**
     * Set the ipAddressPools property: The list of pools of IP addresses that can be allocated to Load Balancer
     * services.
     *
     * @param ipAddressPools the ipAddressPools value to set.
     * @return the BgpServiceLoadBalancerConfiguration object itself.
     */
    public BgpServiceLoadBalancerConfiguration withIpAddressPools(List<IpAddressPool> ipAddressPools) {
        this.ipAddressPools = ipAddressPools;
        return this;
    }

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