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

package com.azure.resourcemanager.dnsresolver.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.dnsresolver.models.DnsResolverState;
import com.azure.resourcemanager.dnsresolver.models.ProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Represents the properties of a DNS resolver. */
@Fluent
public final class DnsResolverProperties {
    /*
     * The reference to the virtual network. This cannot be changed after creation.
     */
    @JsonProperty(value = "virtualNetwork", required = true)
    private SubResource virtualNetwork;

    /*
     * The current status of the DNS resolver. This is a read-only property and any attempt to set this value will be
     * ignored.
     */
    @JsonProperty(value = "dnsResolverState", access = JsonProperty.Access.WRITE_ONLY)
    private DnsResolverState dnsResolverState;

    /*
     * The current provisioning state of the DNS resolver. This is a read-only property and any attempt to set this
     * value will be ignored.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private ProvisioningState provisioningState;

    /*
     * The resourceGuid property of the DNS resolver resource.
     */
    @JsonProperty(value = "resourceGuid", access = JsonProperty.Access.WRITE_ONLY)
    private String resourceGuid;

    /**
     * Get the virtualNetwork property: The reference to the virtual network. This cannot be changed after creation.
     *
     * @return the virtualNetwork value.
     */
    public SubResource virtualNetwork() {
        return this.virtualNetwork;
    }

    /**
     * Set the virtualNetwork property: The reference to the virtual network. This cannot be changed after creation.
     *
     * @param virtualNetwork the virtualNetwork value to set.
     * @return the DnsResolverProperties object itself.
     */
    public DnsResolverProperties withVirtualNetwork(SubResource virtualNetwork) {
        this.virtualNetwork = virtualNetwork;
        return this;
    }

    /**
     * Get the dnsResolverState property: The current status of the DNS resolver. This is a read-only property and any
     * attempt to set this value will be ignored.
     *
     * @return the dnsResolverState value.
     */
    public DnsResolverState dnsResolverState() {
        return this.dnsResolverState;
    }

    /**
     * Get the provisioningState property: The current provisioning state of the DNS resolver. This is a read-only
     * property and any attempt to set this value will be ignored.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

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

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

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