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

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.dnsresolver.fluent.models.ForwardingRulePatchProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

/** Describes a forwarding rule for PATCH operation. */
@Fluent
public final class ForwardingRulePatch {
    /*
     * Updatable properties of the forwarding rule.
     */
    @JsonProperty(value = "properties")
    private ForwardingRulePatchProperties innerProperties;

    /**
     * Get the innerProperties property: Updatable properties of the forwarding rule.
     *
     * @return the innerProperties value.
     */
    private ForwardingRulePatchProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the targetDnsServers property: DNS servers to forward the DNS query to.
     *
     * @return the targetDnsServers value.
     */
    public List<TargetDnsServer> targetDnsServers() {
        return this.innerProperties() == null ? null : this.innerProperties().targetDnsServers();
    }

    /**
     * Set the targetDnsServers property: DNS servers to forward the DNS query to.
     *
     * @param targetDnsServers the targetDnsServers value to set.
     * @return the ForwardingRulePatch object itself.
     */
    public ForwardingRulePatch withTargetDnsServers(List<TargetDnsServer> targetDnsServers) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ForwardingRulePatchProperties();
        }
        this.innerProperties().withTargetDnsServers(targetDnsServers);
        return this;
    }

    /**
     * Get the metadata property: Metadata attached to the forwarding rule.
     *
     * @return the metadata value.
     */
    public Map<String, String> metadata() {
        return this.innerProperties() == null ? null : this.innerProperties().metadata();
    }

    /**
     * Set the metadata property: Metadata attached to the forwarding rule.
     *
     * @param metadata the metadata value to set.
     * @return the ForwardingRulePatch object itself.
     */
    public ForwardingRulePatch withMetadata(Map<String, String> metadata) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ForwardingRulePatchProperties();
        }
        this.innerProperties().withMetadata(metadata);
        return this;
    }

    /**
     * Get the forwardingRuleState property: The state of forwarding rule.
     *
     * @return the forwardingRuleState value.
     */
    public ForwardingRuleState forwardingRuleState() {
        return this.innerProperties() == null ? null : this.innerProperties().forwardingRuleState();
    }

    /**
     * Set the forwardingRuleState property: The state of forwarding rule.
     *
     * @param forwardingRuleState the forwardingRuleState value to set.
     * @return the ForwardingRulePatch object itself.
     */
    public ForwardingRulePatch withForwardingRuleState(ForwardingRuleState forwardingRuleState) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ForwardingRulePatchProperties();
        }
        this.innerProperties().withForwardingRuleState(forwardingRuleState);
        return this;
    }

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