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

package com.azure.resourcemanager.voiceservices.models;

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

/** The configuration used in this region as primary, and other regions as backup. */
@Fluent
public final class PrimaryRegionProperties {
    /*
     * IP address to use to contact the operator network from this region
     */
    @JsonProperty(value = "operatorAddresses", required = true)
    private List<String> operatorAddresses;

    /*
     * IP address to use to contact the ESRP from this region
     */
    @JsonProperty(value = "esrpAddresses")
    private List<String> esrpAddresses;

    /*
     * The allowed source IP address or CIDR ranges for signaling
     */
    @JsonProperty(value = "allowedSignalingSourceAddressPrefixes")
    private List<String> allowedSignalingSourceAddressPrefixes;

    /*
     * The allowed source IP address or CIDR ranges for media
     */
    @JsonProperty(value = "allowedMediaSourceAddressPrefixes")
    private List<String> allowedMediaSourceAddressPrefixes;

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

    /**
     * Get the operatorAddresses property: IP address to use to contact the operator network from this region.
     *
     * @return the operatorAddresses value.
     */
    public List<String> operatorAddresses() {
        return this.operatorAddresses;
    }

    /**
     * Set the operatorAddresses property: IP address to use to contact the operator network from this region.
     *
     * @param operatorAddresses the operatorAddresses value to set.
     * @return the PrimaryRegionProperties object itself.
     */
    public PrimaryRegionProperties withOperatorAddresses(List<String> operatorAddresses) {
        this.operatorAddresses = operatorAddresses;
        return this;
    }

    /**
     * Get the esrpAddresses property: IP address to use to contact the ESRP from this region.
     *
     * @return the esrpAddresses value.
     */
    public List<String> esrpAddresses() {
        return this.esrpAddresses;
    }

    /**
     * Set the esrpAddresses property: IP address to use to contact the ESRP from this region.
     *
     * @param esrpAddresses the esrpAddresses value to set.
     * @return the PrimaryRegionProperties object itself.
     */
    public PrimaryRegionProperties withEsrpAddresses(List<String> esrpAddresses) {
        this.esrpAddresses = esrpAddresses;
        return this;
    }

    /**
     * Get the allowedSignalingSourceAddressPrefixes property: The allowed source IP address or CIDR ranges for
     * signaling.
     *
     * @return the allowedSignalingSourceAddressPrefixes value.
     */
    public List<String> allowedSignalingSourceAddressPrefixes() {
        return this.allowedSignalingSourceAddressPrefixes;
    }

    /**
     * Set the allowedSignalingSourceAddressPrefixes property: The allowed source IP address or CIDR ranges for
     * signaling.
     *
     * @param allowedSignalingSourceAddressPrefixes the allowedSignalingSourceAddressPrefixes value to set.
     * @return the PrimaryRegionProperties object itself.
     */
    public PrimaryRegionProperties withAllowedSignalingSourceAddressPrefixes(
        List<String> allowedSignalingSourceAddressPrefixes) {
        this.allowedSignalingSourceAddressPrefixes = allowedSignalingSourceAddressPrefixes;
        return this;
    }

    /**
     * Get the allowedMediaSourceAddressPrefixes property: The allowed source IP address or CIDR ranges for media.
     *
     * @return the allowedMediaSourceAddressPrefixes value.
     */
    public List<String> allowedMediaSourceAddressPrefixes() {
        return this.allowedMediaSourceAddressPrefixes;
    }

    /**
     * Set the allowedMediaSourceAddressPrefixes property: The allowed source IP address or CIDR ranges for media.
     *
     * @param allowedMediaSourceAddressPrefixes the allowedMediaSourceAddressPrefixes value to set.
     * @return the PrimaryRegionProperties object itself.
     */
    public PrimaryRegionProperties withAllowedMediaSourceAddressPrefixes(
        List<String> allowedMediaSourceAddressPrefixes) {
        this.allowedMediaSourceAddressPrefixes = allowedMediaSourceAddressPrefixes;
        return this;
    }

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

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