// 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;

/** Route Policy Statement properties.. */
@Fluent
public final class RoutePolicyStatementProperties extends AnnotationResource {
    /*
     * Sequence to insert to/delete from existing route.
     */
    @JsonProperty(value = "sequenceNumber", required = true)
    private long sequenceNumber;

    /*
     * Route policy condition properties.
     */
    @JsonProperty(value = "condition", required = true)
    private StatementConditionProperties condition;

    /*
     * Route policy action properties.
     */
    @JsonProperty(value = "action", required = true)
    private StatementActionProperties action;

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

    /**
     * Get the sequenceNumber property: Sequence to insert to/delete from existing route.
     *
     * @return the sequenceNumber value.
     */
    public long sequenceNumber() {
        return this.sequenceNumber;
    }

    /**
     * Set the sequenceNumber property: Sequence to insert to/delete from existing route.
     *
     * @param sequenceNumber the sequenceNumber value to set.
     * @return the RoutePolicyStatementProperties object itself.
     */
    public RoutePolicyStatementProperties withSequenceNumber(long sequenceNumber) {
        this.sequenceNumber = sequenceNumber;
        return this;
    }

    /**
     * Get the condition property: Route policy condition properties.
     *
     * @return the condition value.
     */
    public StatementConditionProperties condition() {
        return this.condition;
    }

    /**
     * Set the condition property: Route policy condition properties.
     *
     * @param condition the condition value to set.
     * @return the RoutePolicyStatementProperties object itself.
     */
    public RoutePolicyStatementProperties withCondition(StatementConditionProperties condition) {
        this.condition = condition;
        return this;
    }

    /**
     * Get the action property: Route policy action properties.
     *
     * @return the action value.
     */
    public StatementActionProperties action() {
        return this.action;
    }

    /**
     * Set the action property: Route policy action properties.
     *
     * @param action the action value to set.
     * @return the RoutePolicyStatementProperties object itself.
     */
    public RoutePolicyStatementProperties withAction(StatementActionProperties action) {
        this.action = action;
        return this;
    }

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

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