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

package com.azure.resourcemanager.signalr.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** The settings for the Upstream when the service is in server-less mode. */
@Fluent
public final class ServerlessUpstreamSettings {
    /*
     * Gets or sets the list of Upstream URL templates. Order matters, and the first matching template takes effects.
     */
    @JsonProperty(value = "templates")
    private List<UpstreamTemplate> templates;

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

    /**
     * Get the templates property: Gets or sets the list of Upstream URL templates. Order matters, and the first
     * matching template takes effects.
     *
     * @return the templates value.
     */
    public List<UpstreamTemplate> templates() {
        return this.templates;
    }

    /**
     * Set the templates property: Gets or sets the list of Upstream URL templates. Order matters, and the first
     * matching template takes effects.
     *
     * @param templates the templates value to set.
     * @return the ServerlessUpstreamSettings object itself.
     */
    public ServerlessUpstreamSettings withTemplates(List<UpstreamTemplate> templates) {
        this.templates = templates;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (templates() != null) {
            templates().forEach(e -> e.validate());
        }
    }
}
