// 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 action properties. */
@Fluent
public final class StatementActionProperties {
    /*
     * localPreference of the route policy.
     */
    @JsonProperty(value = "localPreference")
    private Long localPreference;

    /*
     * action. Example: Permit | Deny.
     */
    @JsonProperty(value = "actionType", required = true)
    private CommunityActionTypes actionType;

    /*
     * IP Community Properties.
     */
    @JsonProperty(value = "ipCommunityProperties")
    private ActionIpCommunityProperties ipCommunityProperties;

    /*
     * IP Extended Community Properties.
     */
    @JsonProperty(value = "ipExtendedCommunityProperties")
    private ActionIpExtendedCommunityProperties ipExtendedCommunityProperties;

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

    /**
     * Get the localPreference property: localPreference of the route policy.
     *
     * @return the localPreference value.
     */
    public Long localPreference() {
        return this.localPreference;
    }

    /**
     * Set the localPreference property: localPreference of the route policy.
     *
     * @param localPreference the localPreference value to set.
     * @return the StatementActionProperties object itself.
     */
    public StatementActionProperties withLocalPreference(Long localPreference) {
        this.localPreference = localPreference;
        return this;
    }

    /**
     * Get the actionType property: action. Example: Permit | Deny.
     *
     * @return the actionType value.
     */
    public CommunityActionTypes actionType() {
        return this.actionType;
    }

    /**
     * Set the actionType property: action. Example: Permit | Deny.
     *
     * @param actionType the actionType value to set.
     * @return the StatementActionProperties object itself.
     */
    public StatementActionProperties withActionType(CommunityActionTypes actionType) {
        this.actionType = actionType;
        return this;
    }

    /**
     * Get the ipCommunityProperties property: IP Community Properties.
     *
     * @return the ipCommunityProperties value.
     */
    public ActionIpCommunityProperties ipCommunityProperties() {
        return this.ipCommunityProperties;
    }

    /**
     * Set the ipCommunityProperties property: IP Community Properties.
     *
     * @param ipCommunityProperties the ipCommunityProperties value to set.
     * @return the StatementActionProperties object itself.
     */
    public StatementActionProperties withIpCommunityProperties(ActionIpCommunityProperties ipCommunityProperties) {
        this.ipCommunityProperties = ipCommunityProperties;
        return this;
    }

    /**
     * Get the ipExtendedCommunityProperties property: IP Extended Community Properties.
     *
     * @return the ipExtendedCommunityProperties value.
     */
    public ActionIpExtendedCommunityProperties ipExtendedCommunityProperties() {
        return this.ipExtendedCommunityProperties;
    }

    /**
     * Set the ipExtendedCommunityProperties property: IP Extended Community Properties.
     *
     * @param ipExtendedCommunityProperties the ipExtendedCommunityProperties value to set.
     * @return the StatementActionProperties object itself.
     */
    public StatementActionProperties withIpExtendedCommunityProperties(
        ActionIpExtendedCommunityProperties ipExtendedCommunityProperties) {
        this.ipExtendedCommunityProperties = ipExtendedCommunityProperties;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (actionType() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property actionType in model StatementActionProperties"));
        }
        if (ipCommunityProperties() != null) {
            ipCommunityProperties().validate();
        }
        if (ipExtendedCommunityProperties() != null) {
            ipExtendedCommunityProperties().validate();
        }
    }

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