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

package com.azure.resourcemanager.apimanagement.fluent.models;

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

/** Network Status details. */
@Fluent
public final class NetworkStatusContractInner {
    /*
     * Gets the list of DNS servers IPV4 addresses.
     */
    @JsonProperty(value = "dnsServers", required = true)
    private List<String> dnsServers;

    /*
     * Gets the list of Connectivity Status to the Resources on which the
     * service depends upon.
     */
    @JsonProperty(value = "connectivityStatus", required = true)
    private List<ConnectivityStatusContract> connectivityStatus;

    /**
     * Get the dnsServers property: Gets the list of DNS servers IPV4 addresses.
     *
     * @return the dnsServers value.
     */
    public List<String> dnsServers() {
        return this.dnsServers;
    }

    /**
     * Set the dnsServers property: Gets the list of DNS servers IPV4 addresses.
     *
     * @param dnsServers the dnsServers value to set.
     * @return the NetworkStatusContractInner object itself.
     */
    public NetworkStatusContractInner withDnsServers(List<String> dnsServers) {
        this.dnsServers = dnsServers;
        return this;
    }

    /**
     * Get the connectivityStatus property: Gets the list of Connectivity Status to the Resources on which the service
     * depends upon.
     *
     * @return the connectivityStatus value.
     */
    public List<ConnectivityStatusContract> connectivityStatus() {
        return this.connectivityStatus;
    }

    /**
     * Set the connectivityStatus property: Gets the list of Connectivity Status to the Resources on which the service
     * depends upon.
     *
     * @param connectivityStatus the connectivityStatus value to set.
     * @return the NetworkStatusContractInner object itself.
     */
    public NetworkStatusContractInner withConnectivityStatus(List<ConnectivityStatusContract> connectivityStatus) {
        this.connectivityStatus = connectivityStatus;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (dnsServers() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property dnsServers in model NetworkStatusContractInner"));
        }
        if (connectivityStatus() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property connectivityStatus in model NetworkStatusContractInner"));
        } else {
            connectivityStatus().forEach(e -> e.validate());
        }
    }

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