// 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.resourcemanager.managednetworkfabric.models.AccessControlListConditionProperties;
import com.azure.resourcemanager.managednetworkfabric.models.AddressFamily;
import com.azure.resourcemanager.managednetworkfabric.models.AnnotationResource;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** AccessControlListPatchProperties define the patchable resource properties. */
@Fluent
public final class AccessControlListPatchProperties extends AnnotationResource {
    /*
     * IP address family. Example: ipv4 | ipv6.
     */
    @JsonProperty(value = "addressFamily")
    private AddressFamily addressFamily;

    /*
     * Access Control List conditions.
     */
    @JsonProperty(value = "conditions")
    private List<AccessControlListConditionProperties> conditions;

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

    /**
     * Get the addressFamily property: IP address family. Example: ipv4 | ipv6.
     *
     * @return the addressFamily value.
     */
    public AddressFamily addressFamily() {
        return this.addressFamily;
    }

    /**
     * Set the addressFamily property: IP address family. Example: ipv4 | ipv6.
     *
     * @param addressFamily the addressFamily value to set.
     * @return the AccessControlListPatchProperties object itself.
     */
    public AccessControlListPatchProperties withAddressFamily(AddressFamily addressFamily) {
        this.addressFamily = addressFamily;
        return this;
    }

    /**
     * Get the conditions property: Access Control List conditions.
     *
     * @return the conditions value.
     */
    public List<AccessControlListConditionProperties> conditions() {
        return this.conditions;
    }

    /**
     * Set the conditions property: Access Control List conditions.
     *
     * @param conditions the conditions value to set.
     * @return the AccessControlListPatchProperties object itself.
     */
    public AccessControlListPatchProperties withConditions(List<AccessControlListConditionProperties> conditions) {
        this.conditions = conditions;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public AccessControlListPatchProperties 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 (conditions() != null) {
            conditions().forEach(e -> e.validate());
        }
    }
}
