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

package com.azure.resourcemanager.managednetworkfabric.models;

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

/** Configuration to be used to setup the management network. */
@Fluent
public final class ManagementNetworkConfiguration {
    /*
     * Configuration for infrastructure vpn.
     */
    @JsonProperty(value = "infrastructureVpnConfiguration", required = true)
    private VpnConfigurationProperties infrastructureVpnConfiguration;

    /*
     * Configuration for workload vpn.
     */
    @JsonProperty(value = "workloadVpnConfiguration", required = true)
    private VpnConfigurationProperties workloadVpnConfiguration;

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

    /**
     * Get the infrastructureVpnConfiguration property: Configuration for infrastructure vpn.
     *
     * @return the infrastructureVpnConfiguration value.
     */
    public VpnConfigurationProperties infrastructureVpnConfiguration() {
        return this.infrastructureVpnConfiguration;
    }

    /**
     * Set the infrastructureVpnConfiguration property: Configuration for infrastructure vpn.
     *
     * @param infrastructureVpnConfiguration the infrastructureVpnConfiguration value to set.
     * @return the ManagementNetworkConfiguration object itself.
     */
    public ManagementNetworkConfiguration withInfrastructureVpnConfiguration(
        VpnConfigurationProperties infrastructureVpnConfiguration) {
        this.infrastructureVpnConfiguration = infrastructureVpnConfiguration;
        return this;
    }

    /**
     * Get the workloadVpnConfiguration property: Configuration for workload vpn.
     *
     * @return the workloadVpnConfiguration value.
     */
    public VpnConfigurationProperties workloadVpnConfiguration() {
        return this.workloadVpnConfiguration;
    }

    /**
     * Set the workloadVpnConfiguration property: Configuration for workload vpn.
     *
     * @param workloadVpnConfiguration the workloadVpnConfiguration value to set.
     * @return the ManagementNetworkConfiguration object itself.
     */
    public ManagementNetworkConfiguration withWorkloadVpnConfiguration(
        VpnConfigurationProperties workloadVpnConfiguration) {
        this.workloadVpnConfiguration = workloadVpnConfiguration;
        return this;
    }

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

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