// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.security.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/**
 * Describes remote addresses that is recommended to communicate with the Azure resource on some (Protocol, Port,
 * Direction). All other remote addresses are recommended to be blocked.
 */
@Fluent
public final class Rule {
    /*
     * The name of the rule
     */
    @JsonProperty(value = "name")
    private String name;

    /*
     * The rule's direction
     */
    @JsonProperty(value = "direction")
    private Direction direction;

    /*
     * The rule's destination port
     */
    @JsonProperty(value = "destinationPort")
    private Integer destinationPort;

    /*
     * The rule's transport protocols
     */
    @JsonProperty(value = "protocols")
    private List<TransportProtocol> protocols;

    /*
     * The remote IP addresses that should be able to communicate with the Azure resource on the rule's destination
     * port and protocol
     */
    @JsonProperty(value = "ipAddresses")
    private List<String> ipAddresses;

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

    /**
     * Get the name property: The name of the rule.
     *
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: The name of the rule.
     *
     * @param name the name value to set.
     * @return the Rule object itself.
     */
    public Rule withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the direction property: The rule's direction.
     *
     * @return the direction value.
     */
    public Direction direction() {
        return this.direction;
    }

    /**
     * Set the direction property: The rule's direction.
     *
     * @param direction the direction value to set.
     * @return the Rule object itself.
     */
    public Rule withDirection(Direction direction) {
        this.direction = direction;
        return this;
    }

    /**
     * Get the destinationPort property: The rule's destination port.
     *
     * @return the destinationPort value.
     */
    public Integer destinationPort() {
        return this.destinationPort;
    }

    /**
     * Set the destinationPort property: The rule's destination port.
     *
     * @param destinationPort the destinationPort value to set.
     * @return the Rule object itself.
     */
    public Rule withDestinationPort(Integer destinationPort) {
        this.destinationPort = destinationPort;
        return this;
    }

    /**
     * Get the protocols property: The rule's transport protocols.
     *
     * @return the protocols value.
     */
    public List<TransportProtocol> protocols() {
        return this.protocols;
    }

    /**
     * Set the protocols property: The rule's transport protocols.
     *
     * @param protocols the protocols value to set.
     * @return the Rule object itself.
     */
    public Rule withProtocols(List<TransportProtocol> protocols) {
        this.protocols = protocols;
        return this;
    }

    /**
     * Get the ipAddresses property: The remote IP addresses that should be able to communicate with the Azure resource
     * on the rule's destination port and protocol.
     *
     * @return the ipAddresses value.
     */
    public List<String> ipAddresses() {
        return this.ipAddresses;
    }

    /**
     * Set the ipAddresses property: The remote IP addresses that should be able to communicate with the Azure resource
     * on the rule's destination port and protocol.
     *
     * @param ipAddresses the ipAddresses value to set.
     * @return the Rule object itself.
     */
    public Rule withIpAddresses(List<String> ipAddresses) {
        this.ipAddresses = ipAddresses;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
    }
}
