// 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.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** BgpAdvertisement represents the association of IP address pools to the communities and peers. */
@Fluent
public final class BgpAdvertisement {
    /*
     * The indicator of if this advertisement is also made to the network fabric associated with the Network Cloud
     * Cluster. This field is ignored if fabricPeeringEnabled is set to False.
     */
    @JsonProperty(value = "advertiseToFabric")
    private AdvertiseToFabric advertiseToFabric;

    /*
     * The names of the BGP communities to be associated with the announcement, utilizing a BGP community string in
     * 1234:1234 format.
     */
    @JsonProperty(value = "communities")
    private List<String> communities;

    /*
     * The names of the IP address pools associated with this announcement.
     */
    @JsonProperty(value = "ipAddressPools", required = true)
    private List<String> ipAddressPools;

    /*
     * The names of the BGP peers to limit this advertisement to. If no values are specified, all BGP peers will
     * receive this advertisement.
     */
    @JsonProperty(value = "peers")
    private List<String> peers;

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

    /**
     * Get the advertiseToFabric property: The indicator of if this advertisement is also made to the network fabric
     * associated with the Network Cloud Cluster. This field is ignored if fabricPeeringEnabled is set to False.
     *
     * @return the advertiseToFabric value.
     */
    public AdvertiseToFabric advertiseToFabric() {
        return this.advertiseToFabric;
    }

    /**
     * Set the advertiseToFabric property: The indicator of if this advertisement is also made to the network fabric
     * associated with the Network Cloud Cluster. This field is ignored if fabricPeeringEnabled is set to False.
     *
     * @param advertiseToFabric the advertiseToFabric value to set.
     * @return the BgpAdvertisement object itself.
     */
    public BgpAdvertisement withAdvertiseToFabric(AdvertiseToFabric advertiseToFabric) {
        this.advertiseToFabric = advertiseToFabric;
        return this;
    }

    /**
     * Get the communities property: The names of the BGP communities to be associated with the announcement, utilizing
     * a BGP community string in 1234:1234 format.
     *
     * @return the communities value.
     */
    public List<String> communities() {
        return this.communities;
    }

    /**
     * Set the communities property: The names of the BGP communities to be associated with the announcement, utilizing
     * a BGP community string in 1234:1234 format.
     *
     * @param communities the communities value to set.
     * @return the BgpAdvertisement object itself.
     */
    public BgpAdvertisement withCommunities(List<String> communities) {
        this.communities = communities;
        return this;
    }

    /**
     * Get the ipAddressPools property: The names of the IP address pools associated with this announcement.
     *
     * @return the ipAddressPools value.
     */
    public List<String> ipAddressPools() {
        return this.ipAddressPools;
    }

    /**
     * Set the ipAddressPools property: The names of the IP address pools associated with this announcement.
     *
     * @param ipAddressPools the ipAddressPools value to set.
     * @return the BgpAdvertisement object itself.
     */
    public BgpAdvertisement withIpAddressPools(List<String> ipAddressPools) {
        this.ipAddressPools = ipAddressPools;
        return this;
    }

    /**
     * Get the peers property: The names of the BGP peers to limit this advertisement to. If no values are specified,
     * all BGP peers will receive this advertisement.
     *
     * @return the peers value.
     */
    public List<String> peers() {
        return this.peers;
    }

    /**
     * Set the peers property: The names of the BGP peers to limit this advertisement to. If no values are specified,
     * all BGP peers will receive this advertisement.
     *
     * @param peers the peers value to set.
     * @return the BgpAdvertisement object itself.
     */
    public BgpAdvertisement withPeers(List<String> peers) {
        this.peers = peers;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (ipAddressPools() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property ipAddressPools in model BgpAdvertisement"));
        }
    }

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