// 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.AdministrativeState;
import com.azure.resourcemanager.managednetworkfabric.models.AnnotationResource;
import com.azure.resourcemanager.managednetworkfabric.models.ConfigurationState;
import com.azure.resourcemanager.managednetworkfabric.models.NetworkTapPropertiesDestinationsItem;
import com.azure.resourcemanager.managednetworkfabric.models.PollingType;
import com.azure.resourcemanager.managednetworkfabric.models.ProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Network Tap Properties defines the properties of the resource. */
@Fluent
public final class NetworkTapProperties extends AnnotationResource {
    /*
     * ARM resource ID of the Network Packet Broker.
     */
    @JsonProperty(value = "networkPacketBrokerId", required = true)
    private String networkPacketBrokerId;

    /*
     * Source Tap Rule Id. ARM Resource ID of the Network Tap Rule.
     */
    @JsonProperty(value = "sourceTapRuleId", access = JsonProperty.Access.WRITE_ONLY)
    private String sourceTapRuleId;

    /*
     * List of destinations to send the filter traffic.
     */
    @JsonProperty(value = "destinations", required = true)
    private List<NetworkTapPropertiesDestinationsItem> destinations;

    /*
     * Polling type.
     */
    @JsonProperty(value = "pollingType")
    private PollingType pollingType;

    /*
     * Gets the configurations state of the resource.
     */
    @JsonProperty(value = "configurationState", access = JsonProperty.Access.WRITE_ONLY)
    private ConfigurationState configurationState;

    /*
     * Provides you the latest status of the NFC service, whether it is Accepted, updating, Succeeded or Failed. During
     * this process, the states keep changing based on the status of Network Tap provisioning.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private ProvisioningState provisioningState;

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

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

    /**
     * Get the networkPacketBrokerId property: ARM resource ID of the Network Packet Broker.
     *
     * @return the networkPacketBrokerId value.
     */
    public String networkPacketBrokerId() {
        return this.networkPacketBrokerId;
    }

    /**
     * Set the networkPacketBrokerId property: ARM resource ID of the Network Packet Broker.
     *
     * @param networkPacketBrokerId the networkPacketBrokerId value to set.
     * @return the NetworkTapProperties object itself.
     */
    public NetworkTapProperties withNetworkPacketBrokerId(String networkPacketBrokerId) {
        this.networkPacketBrokerId = networkPacketBrokerId;
        return this;
    }

    /**
     * Get the sourceTapRuleId property: Source Tap Rule Id. ARM Resource ID of the Network Tap Rule.
     *
     * @return the sourceTapRuleId value.
     */
    public String sourceTapRuleId() {
        return this.sourceTapRuleId;
    }

    /**
     * Get the destinations property: List of destinations to send the filter traffic.
     *
     * @return the destinations value.
     */
    public List<NetworkTapPropertiesDestinationsItem> destinations() {
        return this.destinations;
    }

    /**
     * Set the destinations property: List of destinations to send the filter traffic.
     *
     * @param destinations the destinations value to set.
     * @return the NetworkTapProperties object itself.
     */
    public NetworkTapProperties withDestinations(List<NetworkTapPropertiesDestinationsItem> destinations) {
        this.destinations = destinations;
        return this;
    }

    /**
     * Get the pollingType property: Polling type.
     *
     * @return the pollingType value.
     */
    public PollingType pollingType() {
        return this.pollingType;
    }

    /**
     * Set the pollingType property: Polling type.
     *
     * @param pollingType the pollingType value to set.
     * @return the NetworkTapProperties object itself.
     */
    public NetworkTapProperties withPollingType(PollingType pollingType) {
        this.pollingType = pollingType;
        return this;
    }

    /**
     * Get the configurationState property: Gets the configurations state of the resource.
     *
     * @return the configurationState value.
     */
    public ConfigurationState configurationState() {
        return this.configurationState;
    }

    /**
     * Get the provisioningState property: Provides you the latest status of the NFC service, whether it is Accepted,
     * updating, Succeeded or Failed. During this process, the states keep changing based on the status of Network Tap
     * provisioning.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

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

    /** {@inheritDoc} */
    @Override
    public NetworkTapProperties 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 (networkPacketBrokerId() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property networkPacketBrokerId in model NetworkTapProperties"));
        }
        if (destinations() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property destinations in model NetworkTapProperties"));
        } else {
            destinations().forEach(e -> e.validate());
        }
    }

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