// 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.AnnotationResource;
import com.azure.resourcemanager.managednetworkfabric.models.EnabledDisabledState;
import com.azure.resourcemanager.managednetworkfabric.models.ExternalNetworkPropertiesOptionAProperties;
import com.azure.resourcemanager.managednetworkfabric.models.OptionBProperties;
import com.azure.resourcemanager.managednetworkfabric.models.PeeringOption;
import com.azure.resourcemanager.managednetworkfabric.models.ProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** External Network Properties. */
@Fluent
public final class ExternalNetworkProperties extends AnnotationResource {
    /*
     * Gets the networkToNetworkInterconnectId of the resource.
     */
    @JsonProperty(value = "networkToNetworkInterconnectId", access = JsonProperty.Access.WRITE_ONLY)
    private String networkToNetworkInterconnectId;

    /*
     * List of resources the externalNetwork is disabled on. Can be either entire NetworkFabric or NetworkRack.
     */
    @JsonProperty(value = "disabledOnResources", access = JsonProperty.Access.WRITE_ONLY)
    private List<String> disabledOnResources;

    /*
     * AdministrativeState of the externalNetwork. Example: Enabled | Disabled.
     */
    @JsonProperty(value = "administrativeState", access = JsonProperty.Access.WRITE_ONLY)
    private EnabledDisabledState administrativeState;

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

    /*
     * Peering option list.
     */
    @JsonProperty(value = "peeringOption", required = true)
    private PeeringOption peeringOption;

    /*
     * option B properties object
     */
    @JsonProperty(value = "optionBProperties")
    private OptionBProperties optionBProperties;

    /*
     * option A properties object
     */
    @JsonProperty(value = "optionAProperties")
    private ExternalNetworkPropertiesOptionAProperties optionAProperties;

    /*
     * ARM resource ID of importRoutePolicy.
     */
    @JsonProperty(value = "importRoutePolicyId")
    private String importRoutePolicyId;

    /*
     * ARM resource ID of exportRoutePolicy.
     */
    @JsonProperty(value = "exportRoutePolicyId")
    private String exportRoutePolicyId;

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

    /**
     * Get the networkToNetworkInterconnectId property: Gets the networkToNetworkInterconnectId of the resource.
     *
     * @return the networkToNetworkInterconnectId value.
     */
    public String networkToNetworkInterconnectId() {
        return this.networkToNetworkInterconnectId;
    }

    /**
     * Get the disabledOnResources property: List of resources the externalNetwork is disabled on. Can be either entire
     * NetworkFabric or NetworkRack.
     *
     * @return the disabledOnResources value.
     */
    public List<String> disabledOnResources() {
        return this.disabledOnResources;
    }

    /**
     * Get the administrativeState property: AdministrativeState of the externalNetwork. Example: Enabled | Disabled.
     *
     * @return the administrativeState value.
     */
    public EnabledDisabledState administrativeState() {
        return this.administrativeState;
    }

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

    /**
     * Get the peeringOption property: Peering option list.
     *
     * @return the peeringOption value.
     */
    public PeeringOption peeringOption() {
        return this.peeringOption;
    }

    /**
     * Set the peeringOption property: Peering option list.
     *
     * @param peeringOption the peeringOption value to set.
     * @return the ExternalNetworkProperties object itself.
     */
    public ExternalNetworkProperties withPeeringOption(PeeringOption peeringOption) {
        this.peeringOption = peeringOption;
        return this;
    }

    /**
     * Get the optionBProperties property: option B properties object.
     *
     * @return the optionBProperties value.
     */
    public OptionBProperties optionBProperties() {
        return this.optionBProperties;
    }

    /**
     * Set the optionBProperties property: option B properties object.
     *
     * @param optionBProperties the optionBProperties value to set.
     * @return the ExternalNetworkProperties object itself.
     */
    public ExternalNetworkProperties withOptionBProperties(OptionBProperties optionBProperties) {
        this.optionBProperties = optionBProperties;
        return this;
    }

    /**
     * Get the optionAProperties property: option A properties object.
     *
     * @return the optionAProperties value.
     */
    public ExternalNetworkPropertiesOptionAProperties optionAProperties() {
        return this.optionAProperties;
    }

    /**
     * Set the optionAProperties property: option A properties object.
     *
     * @param optionAProperties the optionAProperties value to set.
     * @return the ExternalNetworkProperties object itself.
     */
    public ExternalNetworkProperties withOptionAProperties(
        ExternalNetworkPropertiesOptionAProperties optionAProperties) {
        this.optionAProperties = optionAProperties;
        return this;
    }

    /**
     * Get the importRoutePolicyId property: ARM resource ID of importRoutePolicy.
     *
     * @return the importRoutePolicyId value.
     */
    public String importRoutePolicyId() {
        return this.importRoutePolicyId;
    }

    /**
     * Set the importRoutePolicyId property: ARM resource ID of importRoutePolicy.
     *
     * @param importRoutePolicyId the importRoutePolicyId value to set.
     * @return the ExternalNetworkProperties object itself.
     */
    public ExternalNetworkProperties withImportRoutePolicyId(String importRoutePolicyId) {
        this.importRoutePolicyId = importRoutePolicyId;
        return this;
    }

    /**
     * Get the exportRoutePolicyId property: ARM resource ID of exportRoutePolicy.
     *
     * @return the exportRoutePolicyId value.
     */
    public String exportRoutePolicyId() {
        return this.exportRoutePolicyId;
    }

    /**
     * Set the exportRoutePolicyId property: ARM resource ID of exportRoutePolicy.
     *
     * @param exportRoutePolicyId the exportRoutePolicyId value to set.
     * @return the ExternalNetworkProperties object itself.
     */
    public ExternalNetworkProperties withExportRoutePolicyId(String exportRoutePolicyId) {
        this.exportRoutePolicyId = exportRoutePolicyId;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ExternalNetworkProperties withAnnotation(String annotation) {
        super.withAnnotation(annotation);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        super.validate();
        if (peeringOption() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property peeringOption in model ExternalNetworkProperties"));
        }
        if (optionBProperties() != null) {
            optionBProperties().validate();
        }
        if (optionAProperties() != null) {
            optionAProperties().validate();
        }
    }

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