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

package com.azure.resourcemanager.cognitiveservices.models;

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

/** The multiregion settings Cognitive Services account. */
@Fluent
public final class MultiRegionSettings {
    /*
     * Multiregion routing methods.
     */
    @JsonProperty(value = "routingMethod")
    private RoutingMethods routingMethod;

    /*
     * The regions property.
     */
    @JsonProperty(value = "regions")
    private List<RegionSetting> regions;

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

    /**
     * Get the routingMethod property: Multiregion routing methods.
     *
     * @return the routingMethod value.
     */
    public RoutingMethods routingMethod() {
        return this.routingMethod;
    }

    /**
     * Set the routingMethod property: Multiregion routing methods.
     *
     * @param routingMethod the routingMethod value to set.
     * @return the MultiRegionSettings object itself.
     */
    public MultiRegionSettings withRoutingMethod(RoutingMethods routingMethod) {
        this.routingMethod = routingMethod;
        return this;
    }

    /**
     * Get the regions property: The regions property.
     *
     * @return the regions value.
     */
    public List<RegionSetting> regions() {
        return this.regions;
    }

    /**
     * Set the regions property: The regions property.
     *
     * @param regions the regions value to set.
     * @return the MultiRegionSettings object itself.
     */
    public MultiRegionSettings withRegions(List<RegionSetting> regions) {
        this.regions = regions;
        return this;
    }

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