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

package com.azure.resourcemanager.servicenetworking.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.servicenetworking.fluent.models.AssociationUpdateProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** The type used for update operations of the Association. */
@Fluent
public final class AssociationUpdate {
    /*
     * Resource tags.
     */
    @JsonProperty(value = "tags")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, String> tags;

    /*
     * The updatable properties of the Association.
     */
    @JsonProperty(value = "properties")
    private AssociationUpdateProperties innerProperties;

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

    /**
     * Get the tags property: Resource tags.
     *
     * @return the tags value.
     */
    public Map<String, String> tags() {
        return this.tags;
    }

    /**
     * Set the tags property: Resource tags.
     *
     * @param tags the tags value to set.
     * @return the AssociationUpdate object itself.
     */
    public AssociationUpdate withTags(Map<String, String> tags) {
        this.tags = tags;
        return this;
    }

    /**
     * Get the innerProperties property: The updatable properties of the Association.
     *
     * @return the innerProperties value.
     */
    private AssociationUpdateProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the associationType property: Association Type.
     *
     * @return the associationType value.
     */
    public AssociationType associationType() {
        return this.innerProperties() == null ? null : this.innerProperties().associationType();
    }

    /**
     * Set the associationType property: Association Type.
     *
     * @param associationType the associationType value to set.
     * @return the AssociationUpdate object itself.
     */
    public AssociationUpdate withAssociationType(AssociationType associationType) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AssociationUpdateProperties();
        }
        this.innerProperties().withAssociationType(associationType);
        return this;
    }

    /**
     * Get the subnet property: Association Subnet.
     *
     * @return the subnet value.
     */
    public AssociationSubnetUpdate subnet() {
        return this.innerProperties() == null ? null : this.innerProperties().subnet();
    }

    /**
     * Set the subnet property: Association Subnet.
     *
     * @param subnet the subnet value to set.
     * @return the AssociationUpdate object itself.
     */
    public AssociationUpdate withSubnet(AssociationSubnetUpdate subnet) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AssociationUpdateProperties();
        }
        this.innerProperties().withSubnet(subnet);
        return this;
    }

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