// 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.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.resourcemanager.security.models.EffectiveNetworkSecurityGroups;
import com.azure.resourcemanager.security.models.Rule;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;

/** The resource whose properties describes the Adaptive Network Hardening settings for some Azure resource. */
@Fluent
public final class AdaptiveNetworkHardeningInner extends ProxyResource {
    /*
     * Properties of the Adaptive Network Hardening resource
     */
    @JsonProperty(value = "properties")
    private AdaptiveNetworkHardeningProperties innerProperties;

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

    /**
     * Get the innerProperties property: Properties of the Adaptive Network Hardening resource.
     *
     * @return the innerProperties value.
     */
    private AdaptiveNetworkHardeningProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the rules property: The security rules which are recommended to be effective on the VM.
     *
     * @return the rules value.
     */
    public List<Rule> rules() {
        return this.innerProperties() == null ? null : this.innerProperties().rules();
    }

    /**
     * Set the rules property: The security rules which are recommended to be effective on the VM.
     *
     * @param rules the rules value to set.
     * @return the AdaptiveNetworkHardeningInner object itself.
     */
    public AdaptiveNetworkHardeningInner withRules(List<Rule> rules) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AdaptiveNetworkHardeningProperties();
        }
        this.innerProperties().withRules(rules);
        return this;
    }

    /**
     * Get the rulesCalculationTime property: The UTC time on which the rules were calculated.
     *
     * @return the rulesCalculationTime value.
     */
    public OffsetDateTime rulesCalculationTime() {
        return this.innerProperties() == null ? null : this.innerProperties().rulesCalculationTime();
    }

    /**
     * Set the rulesCalculationTime property: The UTC time on which the rules were calculated.
     *
     * @param rulesCalculationTime the rulesCalculationTime value to set.
     * @return the AdaptiveNetworkHardeningInner object itself.
     */
    public AdaptiveNetworkHardeningInner withRulesCalculationTime(OffsetDateTime rulesCalculationTime) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AdaptiveNetworkHardeningProperties();
        }
        this.innerProperties().withRulesCalculationTime(rulesCalculationTime);
        return this;
    }

    /**
     * Get the effectiveNetworkSecurityGroups property: The Network Security Groups effective on the network interfaces
     * of the protected resource.
     *
     * @return the effectiveNetworkSecurityGroups value.
     */
    public List<EffectiveNetworkSecurityGroups> effectiveNetworkSecurityGroups() {
        return this.innerProperties() == null ? null : this.innerProperties().effectiveNetworkSecurityGroups();
    }

    /**
     * Set the effectiveNetworkSecurityGroups property: The Network Security Groups effective on the network interfaces
     * of the protected resource.
     *
     * @param effectiveNetworkSecurityGroups the effectiveNetworkSecurityGroups value to set.
     * @return the AdaptiveNetworkHardeningInner object itself.
     */
    public AdaptiveNetworkHardeningInner withEffectiveNetworkSecurityGroups(
        List<EffectiveNetworkSecurityGroups> effectiveNetworkSecurityGroups) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AdaptiveNetworkHardeningProperties();
        }
        this.innerProperties().withEffectiveNetworkSecurityGroups(effectiveNetworkSecurityGroups);
        return this;
    }

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