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

package com.azure.resourcemanager.network.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.SubResource;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.network.models.AddressSpace;
import com.azure.resourcemanager.network.models.DhcpOptions;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Properties of the virtual network. */
@Fluent
public final class VirtualNetworkPropertiesFormat {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualNetworkPropertiesFormat.class);

    /*
     * The AddressSpace that contains an array of IP address ranges that can be
     * used by subnets.
     */
    @JsonProperty(value = "addressSpace")
    private AddressSpace addressSpace;

    /*
     * The dhcpOptions that contains an array of DNS servers available to VMs
     * deployed in the virtual network.
     */
    @JsonProperty(value = "dhcpOptions")
    private DhcpOptions dhcpOptions;

    /*
     * A list of subnets in a Virtual Network.
     */
    @JsonProperty(value = "subnets")
    private List<SubnetInner> subnets;

    /*
     * A list of peerings in a Virtual Network.
     */
    @JsonProperty(value = "virtualNetworkPeerings")
    private List<VirtualNetworkPeeringInner> virtualNetworkPeerings;

    /*
     * The resourceGuid property of the Virtual Network resource.
     */
    @JsonProperty(value = "resourceGuid")
    private String resourceGuid;

    /*
     * The provisioning state of the PublicIP resource. Possible values are:
     * 'Updating', 'Deleting', and 'Failed'.
     */
    @JsonProperty(value = "provisioningState")
    private String provisioningState;

    /*
     * Indicates if DDoS protection is enabled for all the protected resources
     * in the virtual network. It requires a DDoS protection plan associated
     * with the resource.
     */
    @JsonProperty(value = "enableDdosProtection")
    private Boolean enableDdosProtection;

    /*
     * Indicates if VM protection is enabled for all the subnets in the virtual
     * network.
     */
    @JsonProperty(value = "enableVmProtection")
    private Boolean enableVmProtection;

    /*
     * The DDoS protection plan associated with the virtual network.
     */
    @JsonProperty(value = "ddosProtectionPlan")
    private SubResource ddosProtectionPlan;

    /**
     * Get the addressSpace property: The AddressSpace that contains an array of IP address ranges that can be used by
     * subnets.
     *
     * @return the addressSpace value.
     */
    public AddressSpace addressSpace() {
        return this.addressSpace;
    }

    /**
     * Set the addressSpace property: The AddressSpace that contains an array of IP address ranges that can be used by
     * subnets.
     *
     * @param addressSpace the addressSpace value to set.
     * @return the VirtualNetworkPropertiesFormat object itself.
     */
    public VirtualNetworkPropertiesFormat withAddressSpace(AddressSpace addressSpace) {
        this.addressSpace = addressSpace;
        return this;
    }

    /**
     * Get the dhcpOptions property: The dhcpOptions that contains an array of DNS servers available to VMs deployed in
     * the virtual network.
     *
     * @return the dhcpOptions value.
     */
    public DhcpOptions dhcpOptions() {
        return this.dhcpOptions;
    }

    /**
     * Set the dhcpOptions property: The dhcpOptions that contains an array of DNS servers available to VMs deployed in
     * the virtual network.
     *
     * @param dhcpOptions the dhcpOptions value to set.
     * @return the VirtualNetworkPropertiesFormat object itself.
     */
    public VirtualNetworkPropertiesFormat withDhcpOptions(DhcpOptions dhcpOptions) {
        this.dhcpOptions = dhcpOptions;
        return this;
    }

    /**
     * Get the subnets property: A list of subnets in a Virtual Network.
     *
     * @return the subnets value.
     */
    public List<SubnetInner> subnets() {
        return this.subnets;
    }

    /**
     * Set the subnets property: A list of subnets in a Virtual Network.
     *
     * @param subnets the subnets value to set.
     * @return the VirtualNetworkPropertiesFormat object itself.
     */
    public VirtualNetworkPropertiesFormat withSubnets(List<SubnetInner> subnets) {
        this.subnets = subnets;
        return this;
    }

    /**
     * Get the virtualNetworkPeerings property: A list of peerings in a Virtual Network.
     *
     * @return the virtualNetworkPeerings value.
     */
    public List<VirtualNetworkPeeringInner> virtualNetworkPeerings() {
        return this.virtualNetworkPeerings;
    }

    /**
     * Set the virtualNetworkPeerings property: A list of peerings in a Virtual Network.
     *
     * @param virtualNetworkPeerings the virtualNetworkPeerings value to set.
     * @return the VirtualNetworkPropertiesFormat object itself.
     */
    public VirtualNetworkPropertiesFormat withVirtualNetworkPeerings(
        List<VirtualNetworkPeeringInner> virtualNetworkPeerings) {
        this.virtualNetworkPeerings = virtualNetworkPeerings;
        return this;
    }

    /**
     * Get the resourceGuid property: The resourceGuid property of the Virtual Network resource.
     *
     * @return the resourceGuid value.
     */
    public String resourceGuid() {
        return this.resourceGuid;
    }

    /**
     * Set the resourceGuid property: The resourceGuid property of the Virtual Network resource.
     *
     * @param resourceGuid the resourceGuid value to set.
     * @return the VirtualNetworkPropertiesFormat object itself.
     */
    public VirtualNetworkPropertiesFormat withResourceGuid(String resourceGuid) {
        this.resourceGuid = resourceGuid;
        return this;
    }

    /**
     * Get the provisioningState property: The provisioning state of the PublicIP resource. Possible values are:
     * 'Updating', 'Deleting', and 'Failed'.
     *
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.provisioningState;
    }

    /**
     * Set the provisioningState property: The provisioning state of the PublicIP resource. Possible values are:
     * 'Updating', 'Deleting', and 'Failed'.
     *
     * @param provisioningState the provisioningState value to set.
     * @return the VirtualNetworkPropertiesFormat object itself.
     */
    public VirtualNetworkPropertiesFormat withProvisioningState(String provisioningState) {
        this.provisioningState = provisioningState;
        return this;
    }

    /**
     * Get the enableDdosProtection property: Indicates if DDoS protection is enabled for all the protected resources in
     * the virtual network. It requires a DDoS protection plan associated with the resource.
     *
     * @return the enableDdosProtection value.
     */
    public Boolean enableDdosProtection() {
        return this.enableDdosProtection;
    }

    /**
     * Set the enableDdosProtection property: Indicates if DDoS protection is enabled for all the protected resources in
     * the virtual network. It requires a DDoS protection plan associated with the resource.
     *
     * @param enableDdosProtection the enableDdosProtection value to set.
     * @return the VirtualNetworkPropertiesFormat object itself.
     */
    public VirtualNetworkPropertiesFormat withEnableDdosProtection(Boolean enableDdosProtection) {
        this.enableDdosProtection = enableDdosProtection;
        return this;
    }

    /**
     * Get the enableVmProtection property: Indicates if VM protection is enabled for all the subnets in the virtual
     * network.
     *
     * @return the enableVmProtection value.
     */
    public Boolean enableVmProtection() {
        return this.enableVmProtection;
    }

    /**
     * Set the enableVmProtection property: Indicates if VM protection is enabled for all the subnets in the virtual
     * network.
     *
     * @param enableVmProtection the enableVmProtection value to set.
     * @return the VirtualNetworkPropertiesFormat object itself.
     */
    public VirtualNetworkPropertiesFormat withEnableVmProtection(Boolean enableVmProtection) {
        this.enableVmProtection = enableVmProtection;
        return this;
    }

    /**
     * Get the ddosProtectionPlan property: The DDoS protection plan associated with the virtual network.
     *
     * @return the ddosProtectionPlan value.
     */
    public SubResource ddosProtectionPlan() {
        return this.ddosProtectionPlan;
    }

    /**
     * Set the ddosProtectionPlan property: The DDoS protection plan associated with the virtual network.
     *
     * @param ddosProtectionPlan the ddosProtectionPlan value to set.
     * @return the VirtualNetworkPropertiesFormat object itself.
     */
    public VirtualNetworkPropertiesFormat withDdosProtectionPlan(SubResource ddosProtectionPlan) {
        this.ddosProtectionPlan = ddosProtectionPlan;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (addressSpace() != null) {
            addressSpace().validate();
        }
        if (dhcpOptions() != null) {
            dhcpOptions().validate();
        }
        if (subnets() != null) {
            subnets().forEach(e -> e.validate());
        }
        if (virtualNetworkPeerings() != null) {
            virtualNetworkPeerings().forEach(e -> e.validate());
        }
    }
}
