// 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.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.managednetworkfabric.models.BooleanEnumProperty;
import com.azure.resourcemanager.managednetworkfabric.models.EnabledDisabledState;
import com.azure.resourcemanager.managednetworkfabric.models.Layer2Configuration;
import com.azure.resourcemanager.managednetworkfabric.models.Layer3Configuration;
import com.azure.resourcemanager.managednetworkfabric.models.NniType;
import com.azure.resourcemanager.managednetworkfabric.models.ProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Configuration used to setup CE-PE connectivity. */
@Fluent
public final class NetworkToNetworkInterconnectProperties {
    /*
     * Type of NNI used. Example: CE | NPB
     */
    @JsonProperty(value = "nniType")
    private NniType nniType;

    /*
     * Gets the administrativeState of the resource. Example -Enabled/Disabled
     */
    @JsonProperty(value = "administrativeState", access = JsonProperty.Access.WRITE_ONLY)
    private EnabledDisabledState administrativeState;

    /*
     * Configuration to use NNI for Infrastructure Management. Example: True/False.
     */
    @JsonProperty(value = "isManagementType", required = true)
    private BooleanEnumProperty isManagementType;

    /*
     * Based on this parameter the layer2/layer3 is made as mandatory. Example: True/False
     */
    @JsonProperty(value = "useOptionB", required = true)
    private BooleanEnumProperty useOptionB;

    /*
     * Common properties for Layer2Configuration.
     */
    @JsonProperty(value = "layer2Configuration")
    private Layer2Configuration layer2Configuration;

    /*
     * Common properties for Layer3Configuration.
     */
    @JsonProperty(value = "layer3Configuration")
    private Layer3Configuration layer3Configuration;

    /*
     * Gets the provisioning state of the resource.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private ProvisioningState provisioningState;

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

    /**
     * Get the nniType property: Type of NNI used. Example: CE | NPB.
     *
     * @return the nniType value.
     */
    public NniType nniType() {
        return this.nniType;
    }

    /**
     * Set the nniType property: Type of NNI used. Example: CE | NPB.
     *
     * @param nniType the nniType value to set.
     * @return the NetworkToNetworkInterconnectProperties object itself.
     */
    public NetworkToNetworkInterconnectProperties withNniType(NniType nniType) {
        this.nniType = nniType;
        return this;
    }

    /**
     * Get the administrativeState property: Gets the administrativeState of the resource. Example -Enabled/Disabled.
     *
     * @return the administrativeState value.
     */
    public EnabledDisabledState administrativeState() {
        return this.administrativeState;
    }

    /**
     * Get the isManagementType property: Configuration to use NNI for Infrastructure Management. Example: True/False.
     *
     * @return the isManagementType value.
     */
    public BooleanEnumProperty isManagementType() {
        return this.isManagementType;
    }

    /**
     * Set the isManagementType property: Configuration to use NNI for Infrastructure Management. Example: True/False.
     *
     * @param isManagementType the isManagementType value to set.
     * @return the NetworkToNetworkInterconnectProperties object itself.
     */
    public NetworkToNetworkInterconnectProperties withIsManagementType(BooleanEnumProperty isManagementType) {
        this.isManagementType = isManagementType;
        return this;
    }

    /**
     * Get the useOptionB property: Based on this parameter the layer2/layer3 is made as mandatory. Example: True/False.
     *
     * @return the useOptionB value.
     */
    public BooleanEnumProperty useOptionB() {
        return this.useOptionB;
    }

    /**
     * Set the useOptionB property: Based on this parameter the layer2/layer3 is made as mandatory. Example: True/False.
     *
     * @param useOptionB the useOptionB value to set.
     * @return the NetworkToNetworkInterconnectProperties object itself.
     */
    public NetworkToNetworkInterconnectProperties withUseOptionB(BooleanEnumProperty useOptionB) {
        this.useOptionB = useOptionB;
        return this;
    }

    /**
     * Get the layer2Configuration property: Common properties for Layer2Configuration.
     *
     * @return the layer2Configuration value.
     */
    public Layer2Configuration layer2Configuration() {
        return this.layer2Configuration;
    }

    /**
     * Set the layer2Configuration property: Common properties for Layer2Configuration.
     *
     * @param layer2Configuration the layer2Configuration value to set.
     * @return the NetworkToNetworkInterconnectProperties object itself.
     */
    public NetworkToNetworkInterconnectProperties withLayer2Configuration(Layer2Configuration layer2Configuration) {
        this.layer2Configuration = layer2Configuration;
        return this;
    }

    /**
     * Get the layer3Configuration property: Common properties for Layer3Configuration.
     *
     * @return the layer3Configuration value.
     */
    public Layer3Configuration layer3Configuration() {
        return this.layer3Configuration;
    }

    /**
     * Set the layer3Configuration property: Common properties for Layer3Configuration.
     *
     * @param layer3Configuration the layer3Configuration value to set.
     * @return the NetworkToNetworkInterconnectProperties object itself.
     */
    public NetworkToNetworkInterconnectProperties withLayer3Configuration(Layer3Configuration layer3Configuration) {
        this.layer3Configuration = layer3Configuration;
        return this;
    }

    /**
     * Get the provisioningState property: Gets the provisioning state of the resource.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

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

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