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

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

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

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

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

    /**
     * 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 AccessControlListProperties object itself.
     */
    public AccessControlListProperties 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 AccessControlListProperties object itself.
     */
    public AccessControlListProperties withConditions(List<AccessControlListConditionProperties> conditions) {
        this.conditions = conditions;
        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 AccessControlListProperties 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 (addressFamily() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property addressFamily in model AccessControlListProperties"));
        }
        if (conditions() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property conditions in model AccessControlListProperties"));
        } else {
            conditions().forEach(e -> e.validate());
        }
    }

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