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

/** RoutePolicy Properties define the resource properties. */
@Fluent
public final class RoutePolicyProperties extends AnnotationResource {
    /*
     * Route Policy statements.
     */
    @JsonProperty(value = "statements", required = true)
    private List<RoutePolicyStatementProperties> statements;

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

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

    /**
     * Get the statements property: Route Policy statements.
     *
     * @return the statements value.
     */
    public List<RoutePolicyStatementProperties> statements() {
        return this.statements;
    }

    /**
     * Set the statements property: Route Policy statements.
     *
     * @param statements the statements value to set.
     * @return the RoutePolicyProperties object itself.
     */
    public RoutePolicyProperties withStatements(List<RoutePolicyStatementProperties> statements) {
        this.statements = statements;
        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 RoutePolicyProperties 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 (statements() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property statements in model RoutePolicyProperties"));
        } else {
            statements().forEach(e -> e.validate());
        }
    }

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