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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.managednetworkfabric.models.AnnotationResource;
import com.azure.resourcemanager.managednetworkfabric.models.CommunityActionTypes;
import com.azure.resourcemanager.managednetworkfabric.models.ProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** IpExtendedCommunityProperties define the resource properties. */
@Fluent
public final class IpExtendedCommunityProperties extends AnnotationResource {
    /*
     * Action to be taken on the configuration. Example: Permit | Deny.
     */
    @JsonProperty(value = "action", required = true)
    private CommunityActionTypes action;

    /*
     * Route Target List.The expected formats are ASN(plain):NN >> example 4294967294:50, ASN.ASN:NN >> example
     * 65533.65333:40, IP-address:NN >> example 10.10.10.10:65535. The possible values of ASN,NN are in range of
     * 0-65535, ASN(plain) is in range of 0-4294967295.
     */
    @JsonProperty(value = "routeTargets", required = true)
    private List<String> routeTargets;

    /*
     * Gets the provisioning state of the resource.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private ProvisioningState provisioningState;

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

    /**
     * Get the action property: Action to be taken on the configuration. Example: Permit | Deny.
     *
     * @return the action value.
     */
    public CommunityActionTypes action() {
        return this.action;
    }

    /**
     * Set the action property: Action to be taken on the configuration. Example: Permit | Deny.
     *
     * @param action the action value to set.
     * @return the IpExtendedCommunityProperties object itself.
     */
    public IpExtendedCommunityProperties withAction(CommunityActionTypes action) {
        this.action = action;
        return this;
    }

    /**
     * Get the routeTargets property: Route Target List.The expected formats are ASN(plain):NN &gt;&gt; example
     * 4294967294:50, ASN.ASN:NN &gt;&gt; example 65533.65333:40, IP-address:NN &gt;&gt; example 10.10.10.10:65535. The
     * possible values of ASN,NN are in range of 0-65535, ASN(plain) is in range of 0-4294967295.
     *
     * @return the routeTargets value.
     */
    public List<String> routeTargets() {
        return this.routeTargets;
    }

    /**
     * Set the routeTargets property: Route Target List.The expected formats are ASN(plain):NN &gt;&gt; example
     * 4294967294:50, ASN.ASN:NN &gt;&gt; example 65533.65333:40, IP-address:NN &gt;&gt; example 10.10.10.10:65535. The
     * possible values of ASN,NN are in range of 0-65535, ASN(plain) is in range of 0-4294967295.
     *
     * @param routeTargets the routeTargets value to set.
     * @return the IpExtendedCommunityProperties object itself.
     */
    public IpExtendedCommunityProperties withRouteTargets(List<String> routeTargets) {
        this.routeTargets = routeTargets;
        return this;
    }

    /**
     * Get the provisioningState property: Gets the provisioning state of the resource.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /** {@inheritDoc} */
    @Override
    public IpExtendedCommunityProperties withAnnotation(String annotation) {
        super.withAnnotation(annotation);
        return this;
    }

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

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