// 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.resourcemanager.managednetworkfabric.models.AdministrativeState;
import com.azure.resourcemanager.managednetworkfabric.models.AnnotationResource;
import com.azure.resourcemanager.managednetworkfabric.models.CommonDynamicMatchConfiguration;
import com.azure.resourcemanager.managednetworkfabric.models.ConfigurationState;
import com.azure.resourcemanager.managednetworkfabric.models.ConfigurationType;
import com.azure.resourcemanager.managednetworkfabric.models.NetworkTapRuleMatchConfiguration;
import com.azure.resourcemanager.managednetworkfabric.models.PollingIntervalInSeconds;
import com.azure.resourcemanager.managednetworkfabric.models.ProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;

/** Network Tap Rule Properties defines the resource properties. */
@Fluent
public final class NetworkTapRuleProperties extends AnnotationResource {
    /*
     * The ARM resource Id of the NetworkTap.
     */
    @JsonProperty(value = "networkTapId", access = JsonProperty.Access.WRITE_ONLY)
    private String networkTapId;

    /*
     * Polling interval in seconds.
     */
    @JsonProperty(value = "pollingIntervalInSeconds")
    private PollingIntervalInSeconds pollingIntervalInSeconds;

    /*
     * The last sync timestamp.
     */
    @JsonProperty(value = "lastSyncedTime", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime lastSyncedTime;

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

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

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

    /*
     * Input method to configure Network Tap Rule.
     */
    @JsonProperty(value = "configurationType")
    private ConfigurationType configurationType;

    /*
     * Network Tap Rules file URL.
     */
    @JsonProperty(value = "tapRulesUrl")
    private String tapRulesUrl;

    /*
     * List of match configurations.
     */
    @JsonProperty(value = "matchConfigurations")
    private List<NetworkTapRuleMatchConfiguration> matchConfigurations;

    /*
     * List of dynamic match configurations.
     */
    @JsonProperty(value = "dynamicMatchConfigurations")
    private List<CommonDynamicMatchConfiguration> dynamicMatchConfigurations;

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

    /**
     * Get the networkTapId property: The ARM resource Id of the NetworkTap.
     *
     * @return the networkTapId value.
     */
    public String networkTapId() {
        return this.networkTapId;
    }

    /**
     * Get the pollingIntervalInSeconds property: Polling interval in seconds.
     *
     * @return the pollingIntervalInSeconds value.
     */
    public PollingIntervalInSeconds pollingIntervalInSeconds() {
        return this.pollingIntervalInSeconds;
    }

    /**
     * Set the pollingIntervalInSeconds property: Polling interval in seconds.
     *
     * @param pollingIntervalInSeconds the pollingIntervalInSeconds value to set.
     * @return the NetworkTapRuleProperties object itself.
     */
    public NetworkTapRuleProperties withPollingIntervalInSeconds(PollingIntervalInSeconds pollingIntervalInSeconds) {
        this.pollingIntervalInSeconds = pollingIntervalInSeconds;
        return this;
    }

    /**
     * Get the lastSyncedTime property: The last sync timestamp.
     *
     * @return the lastSyncedTime value.
     */
    public OffsetDateTime lastSyncedTime() {
        return this.lastSyncedTime;
    }

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

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

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

    /**
     * Get the configurationType property: Input method to configure Network Tap Rule.
     *
     * @return the configurationType value.
     */
    public ConfigurationType configurationType() {
        return this.configurationType;
    }

    /**
     * Set the configurationType property: Input method to configure Network Tap Rule.
     *
     * @param configurationType the configurationType value to set.
     * @return the NetworkTapRuleProperties object itself.
     */
    public NetworkTapRuleProperties withConfigurationType(ConfigurationType configurationType) {
        this.configurationType = configurationType;
        return this;
    }

    /**
     * Get the tapRulesUrl property: Network Tap Rules file URL.
     *
     * @return the tapRulesUrl value.
     */
    public String tapRulesUrl() {
        return this.tapRulesUrl;
    }

    /**
     * Set the tapRulesUrl property: Network Tap Rules file URL.
     *
     * @param tapRulesUrl the tapRulesUrl value to set.
     * @return the NetworkTapRuleProperties object itself.
     */
    public NetworkTapRuleProperties withTapRulesUrl(String tapRulesUrl) {
        this.tapRulesUrl = tapRulesUrl;
        return this;
    }

    /**
     * Get the matchConfigurations property: List of match configurations.
     *
     * @return the matchConfigurations value.
     */
    public List<NetworkTapRuleMatchConfiguration> matchConfigurations() {
        return this.matchConfigurations;
    }

    /**
     * Set the matchConfigurations property: List of match configurations.
     *
     * @param matchConfigurations the matchConfigurations value to set.
     * @return the NetworkTapRuleProperties object itself.
     */
    public NetworkTapRuleProperties withMatchConfigurations(
        List<NetworkTapRuleMatchConfiguration> matchConfigurations) {
        this.matchConfigurations = matchConfigurations;
        return this;
    }

    /**
     * Get the dynamicMatchConfigurations property: List of dynamic match configurations.
     *
     * @return the dynamicMatchConfigurations value.
     */
    public List<CommonDynamicMatchConfiguration> dynamicMatchConfigurations() {
        return this.dynamicMatchConfigurations;
    }

    /**
     * Set the dynamicMatchConfigurations property: List of dynamic match configurations.
     *
     * @param dynamicMatchConfigurations the dynamicMatchConfigurations value to set.
     * @return the NetworkTapRuleProperties object itself.
     */
    public NetworkTapRuleProperties withDynamicMatchConfigurations(
        List<CommonDynamicMatchConfiguration> dynamicMatchConfigurations) {
        this.dynamicMatchConfigurations = dynamicMatchConfigurations;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public NetworkTapRuleProperties 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 (matchConfigurations() != null) {
            matchConfigurations().forEach(e -> e.validate());
        }
        if (dynamicMatchConfigurations() != null) {
            dynamicMatchConfigurations().forEach(e -> e.validate());
        }
    }
}
