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

package com.azure.resourcemanager.managednetworkfabric.models;

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

/** The IP Extended Communities patch resource definition. */
@Fluent
public final class IpExtendedCommunityPatch extends TagsUpdate {
    /*
     * IP Extended Community patchable properties.
     */
    @JsonProperty(value = "properties")
    private IpExtendedCommunityPatchProperties innerProperties;

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

    /**
     * Get the innerProperties property: IP Extended Community patchable properties.
     *
     * @return the innerProperties value.
     */
    private IpExtendedCommunityPatchProperties innerProperties() {
        return this.innerProperties;
    }

    /** {@inheritDoc} */
    @Override
    public IpExtendedCommunityPatch withTags(Map<String, String> tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the annotation property: Switch configuration description.
     *
     * @return the annotation value.
     */
    public String annotation() {
        return this.innerProperties() == null ? null : this.innerProperties().annotation();
    }

    /**
     * Set the annotation property: Switch configuration description.
     *
     * @param annotation the annotation value to set.
     * @return the IpExtendedCommunityPatch object itself.
     */
    public IpExtendedCommunityPatch withAnnotation(String annotation) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IpExtendedCommunityPatchProperties();
        }
        this.innerProperties().withAnnotation(annotation);
        return this;
    }

    /**
     * Get the ipExtendedCommunityRules property: List of IP Extended Community Rules.
     *
     * @return the ipExtendedCommunityRules value.
     */
    public List<IpExtendedCommunityRule> ipExtendedCommunityRules() {
        return this.innerProperties() == null ? null : this.innerProperties().ipExtendedCommunityRules();
    }

    /**
     * Set the ipExtendedCommunityRules property: List of IP Extended Community Rules.
     *
     * @param ipExtendedCommunityRules the ipExtendedCommunityRules value to set.
     * @return the IpExtendedCommunityPatch object itself.
     */
    public IpExtendedCommunityPatch withIpExtendedCommunityRules(
        List<IpExtendedCommunityRule> ipExtendedCommunityRules) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IpExtendedCommunityPatchProperties();
        }
        this.innerProperties().withIpExtendedCommunityRules(ipExtendedCommunityRules);
        return this;
    }

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