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

package com.azure.resourcemanager.datalakestore.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.datalakestore.fluent.models.UpdateVirtualNetworkRuleProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

/** The parameters used to update a virtual network rule while updating a Data Lake Store account. */
@Fluent
public final class UpdateVirtualNetworkRuleWithAccountParameters {
    /*
     * The unique name of the virtual network rule to update.
     */
    @JsonProperty(value = "name", required = true)
    private String name;

    /*
     * The virtual network rule properties to use when updating a virtual network rule.
     */
    @JsonProperty(value = "properties")
    private UpdateVirtualNetworkRuleProperties innerProperties;

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

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

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

    /**
     * Get the innerProperties property: The virtual network rule properties to use when updating a virtual network
     * rule.
     *
     * @return the innerProperties value.
     */
    private UpdateVirtualNetworkRuleProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the subnetId property: The resource identifier for the subnet.
     *
     * @return the subnetId value.
     */
    public String subnetId() {
        return this.innerProperties() == null ? null : this.innerProperties().subnetId();
    }

    /**
     * Set the subnetId property: The resource identifier for the subnet.
     *
     * @param subnetId the subnetId value to set.
     * @return the UpdateVirtualNetworkRuleWithAccountParameters object itself.
     */
    public UpdateVirtualNetworkRuleWithAccountParameters withSubnetId(String subnetId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UpdateVirtualNetworkRuleProperties();
        }
        this.innerProperties().withSubnetId(subnetId);
        return this;
    }

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

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